@univerjs-pro/collaboration-service 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +49 -49
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object['defineProperty'](exports,Symbol['toStringTag'],{'value':'Module'});var e=Object['create'],t=Object['defineProperty'],n=Object['getOwnPropertyDescriptor'],r=Object['getOwnPropertyNames'],i=Object['getPrototypeOf'],a=Object['prototype']['hasOwnProperty'],o=(_0x376678,_0x361853,_0x50ab16,_0x4d1251)=>{if(_0x361853&&typeof _0x361853=='object'||typeof _0x361853=='function'){for(var _0x12ee0a=r(_0x361853),_0x3a7898=0x0,_0x146bfb=_0x12ee0a['length'],_0x37ab29;_0x3a7898<_0x146bfb;_0x3a7898++)_0x37ab29=_0x12ee0a[_0x3a7898],!a['call'](_0x376678,_0x37ab29)&&_0x37ab29!==_0x50ab16&&t(_0x376678,_0x37ab29,{'get':(_0x1703ea=>_0x361853[_0x1703ea])['bind'](null,_0x37ab29),'enumerable':!(_0x4d1251=n(_0x361853,_0x37ab29))||_0x4d1251['enumerable']});}return _0x376678;},s=(_0x34a3b2,_0x403c7a,_0x2e1c6b)=>(_0x2e1c6b=_0x34a3b2==null?{}:e(i(_0x34a3b2)),o(_0x403c7a||!_0x34a3b2||!_0x34a3b2['__esModule']?t(_0x2e1c6b,'default',{'value':_0x34a3b2,'enumerable':!0x0}):_0x2e1c6b,_0x34a3b2));let c=require('@univerjs/protocol'),l=require('@univerjs-pro/collaboration'),u=require('@univerjs/core'),d=require('@univerjs/engine-formula'),f=require('@univerjs/sheets/locale/en-US');f=s(f,0x1);let p=require('@univerjs-pro/bases'),ee=require('@univerjs-pro/boards'),m=require('@univerjs/docs'),h=require('@univerjs/sheets'),g=require('@univerjs/sheets-conditional-formatting'),_=require('@univerjs/data-validation'),te=require('@univerjs/sheets-filter'),v=require('@univerjs/thread-comment'),y=require('@univerjs-pro/slides-chart'),b=require('@univerjs-pro/slides'),x=require('@univerjs-pro/slides-table'),ne=require('node:async_hooks'),re=require('@univerjs-pro/bases-dashboard'),ie=require('@univerjs-pro/bases-thread-comment'),ae=require('@univerjs-pro/boards-chart'),oe=require('@univerjs-pro/boards-mind'),se=require('@univerjs-pro/boards-table'),ce=require('@univerjs-pro/boards-thread-comment'),le=require('@univerjs-pro/docs-callout'),ue=require('@univerjs-pro/docs-chart'),de=require('@univerjs-pro/docs-code'),fe=require('@univerjs-pro/docs-latex'),pe=require('@univerjs-pro/docs-shape'),me=require('@univerjs-pro/docs-table'),he=require('@univerjs-pro/embed'),ge=require('@univerjs-pro/engine-formula-rust'),_e=require('@univerjs-pro/sheets-chart'),ve=require('@univerjs-pro/sheets-outline'),ye=require('@univerjs-pro/sheets-pivot'),be=require('@univerjs-pro/sheets-shape'),xe=require('@univerjs-pro/sheets-sparkline'),Se=require('@univerjs-pro/slides-thread-comment'),Ce=require('@univerjs-pro/thread-comment-resource'),we=require('@univerjs/docs-drawing'),Te=require('@univerjs/docs-hyper-link'),Ee=require('@univerjs/docs-thread-comment'),De=require('@univerjs/drawing'),Oe=require('@univerjs/sheets-drawing'),ke=require('@univerjs/sheets-formula'),Ae=require('@univerjs/sheets-hyper-link'),je=require('@univerjs/sheets-note'),Me=require('@univerjs/sheets-sort'),Ne=require('@univerjs/sheets-table'),Pe=require('@univerjs/sheets-thread-comment');var S=class extends Error{['code'];['retryable'];['details'];constructor(_0x4a965b,_0x23f0c3,_0x48bd90={}){super(_0x23f0c3,{'cause':_0x48bd90['cause']}),this['name']='CollabError',this['code']=_0x4a965b,this['retryable']=_0x48bd90['retryable']??!0x1,_0x48bd90['details']!==void 0x0&&(this['details']=_0x48bd90['details']);}},Fe=0xa*0x400*0x400,Ie={'shouldCreate'(_0x179df5){if(_0x179df5['changesetBytes']>Fe)return!0x0;let _0xdbe740=_0x179df5['type']===c['UniverType']['UNIVER_DOC']?0x32:_0x179df5['type']===c['UniverType']['UNIVER_SHEET']||_0x179df5['type']===c['UniverType']['UNIVER_SLIDE']||_0x179df5['type']===c['UniverType']['UNIVER_BOARD']||_0x179df5['type']===c['UniverType']['UNIVER_BASE']?0x5:0x0;return _0xdbe740>0x0&&_0x179df5['revision']%_0xdbe740===0x0;}};function C(_0x4424e9){return Re(_0x4424e9),{'userID':_0x4424e9['userID'],'customData':_0x4424e9['customData']??Object['create'](null)};}function Le(_0x297916){if(Re(_0x297916),typeof _0x297916['memberID']!='string'||_0x297916['memberID']['length']===0x0)throw w('memberID\x20must\x20be\x20a\x20non-empty\x20string');return{'userID':_0x297916['userID'],'memberID':_0x297916['memberID'],'customData':_0x297916['customData']??Object['create'](null)};}function Re(_0x5706fb){if(!_0x5706fb||typeof _0x5706fb!='object')throw w('context\x20must\x20be\x20an\x20object');if(typeof _0x5706fb['userID']!='string'||_0x5706fb['userID']['length']===0x0)throw w('userID\x20must\x20be\x20a\x20non-empty\x20string');if(_0x5706fb['customData']!==void 0x0&&(_0x5706fb['customData']===null||typeof _0x5706fb['customData']!='object'||Array['isArray'](_0x5706fb['customData'])))throw w('customData\x20must\x20be\x20an\x20object');}function w(_0x1cf3a1){return new S('INVALID_REQUEST',_0x1cf3a1);}var ze=class{['_middlewares']=new Map();['use'](_0x558053,_0x486bd8){let _0x1cde8c=this['_middlewares']['get'](_0x558053)??[],_0x418a43=_0x486bd8;_0x1cde8c['push'](_0x418a43),this['_middlewares']['set'](_0x558053,_0x1cde8c);let _0x51631e=!0x1;return{'dispose':()=>{if(_0x51631e)return;_0x51631e=!0x0;let _0x4a1e3a=_0x1cde8c['indexOf'](_0x418a43);_0x4a1e3a>=0x0&&_0x1cde8c['splice'](_0x4a1e3a,0x1);}};}async['run'](_0x15ddd7,_0x448e08,_0x2fd388){let _0x4d8078=[...this['_middlewares']['get'](_0x15ddd7)??[]],_0x3857cd=async _0x1e6283=>{let _0x5c66ca=_0x4d8078[_0x1e6283];if(!_0x5c66ca){await _0x2fd388();return;}let _0x38fcd1=!0x1,_0x1e5cbf,_0x4244ad=()=>{if(_0x38fcd1)throw Error('Middleware\x20for\x20action\x20'+String(_0x15ddd7)+'\x20called\x20next()\x20more\x20than\x20once');return _0x38fcd1=!0x0,_0x1e5cbf=_0x3857cd(_0x1e6283+0x1),_0x1e5cbf;};try{await _0x5c66ca(_0x448e08,_0x4244ad);}catch(_0x1b33e4){if(_0x1e5cbf)try{await _0x1e5cbf;}catch{}throw _0x1b33e4;}if(!_0x38fcd1)throw Error('Middleware\x20for\x20action\x20'+String(_0x15ddd7)+'\x20completed\x20without\x20calling\x20next()');await _0x1e5cbf;};await _0x3857cd(0x0);}['clear'](){this['_middlewares']['clear']();}},Be={'debug':()=>void 0x0,'info':()=>void 0x0,'warn':()=>void 0x0,'error':()=>void 0x0},Ve={'increment':()=>void 0x0,'observe':()=>void 0x0};function He(_0x57b959){return _0x57b959?{'debug':(..._0x48b8c0)=>T(()=>_0x57b959['debug'](..._0x48b8c0)),'info':(..._0xe5f517)=>T(()=>_0x57b959['info'](..._0xe5f517)),'warn':(..._0x1d4c08)=>T(()=>_0x57b959['warn'](..._0x1d4c08)),'error':(..._0x11d5d1)=>T(()=>_0x57b959['error'](..._0x11d5d1))}:Be;}function Ue(_0x397868){return _0x397868?{'increment':(..._0xc3484a)=>T(()=>_0x397868['increment'](..._0xc3484a)),'observe':(..._0x44469e)=>T(()=>_0x397868['observe'](..._0x44469e))}:Ve;}function T(_0x2a818b){try{_0x2a818b();}catch{}}function We(_0x429ba8){return{..._0x429ba8};}function Ge(_0x15bc5c){return{..._0x15bc5c};}function Ke(_0x26b31d){return{..._0x26b31d};}function qe(_0x591294){return{..._0x591294};}function Je(_0x284164){return{'unitIDs':_0x284164['unitIDs'],'hardDelete':_0x284164['hardDelete']??!0x1};}function Ye(_0xd44810){return{'unitIDs':_0xd44810['unitIDs']};}function Xe(_0x26466c,_0x5b91eb){return{'changeset':{..._0x26466c['changeset'],'userID':_0x5b91eb['userID'],'memberID':_0x5b91eb['memberID']}};}async function Ze(_0x1b7192){let _0x3ce1a8=$e(),_0x396192=(await Qe(_0x1b7192,_0x3ce1a8['service']))['snapshot']??_0x3ce1a8['snapshot'];if(!_0x396192||_0x396192['unitID']!==_0x1b7192['data']['id']||_0x396192['type']!==_0x1b7192['type']||_0x396192['rev']!==0x1)throw Error('SDK\x20Unit\x20data\x20transform\x20returned\x20an\x20invalid\x20snapshot');return{'snapshot':_0x396192,..._0x3ce1a8['sheetBlocks']['length']>0x0?{'sheetBlocks':_0x3ce1a8['sheetBlocks']}:{}};}function Qe(_0x3448f1,_0x5d29c7){switch(_0x3448f1['type']){case c['UniverType']['UNIVER_SHEET']:{let _0x11d466=structuredClone(_0x3448f1['data']);return(0x0,l['transformWorkbookDataToSnapshot'])({},_0x11d466,_0x11d466['id'],0x1,_0x5d29c7);}case c['UniverType']['UNIVER_DOC']:{let _0x289a7f=structuredClone(_0x3448f1['data']);return(0x0,l['transformDocumentDataToSnapshot'])({},_0x289a7f,_0x289a7f['id'],0x1,_0x5d29c7);}case c['UniverType']['UNIVER_SLIDE']:{let _0x436015=structuredClone(_0x3448f1['data']);return(0x0,l['transformSlideDataToSnapshot'])(_0x436015['resources'],_0x436015,_0x436015['id'],0x1,_0x5d29c7);}case c['UniverType']['UNIVER_BOARD']:{let _0x323c4c=structuredClone(_0x3448f1['data']);return(0x0,l['transformBoardDataToSnapshot'])(_0x323c4c['resources'],_0x323c4c,_0x323c4c['id'],0x1,_0x5d29c7);}case c['UniverType']['UNIVER_BASE']:{let _0x1303fb=structuredClone(_0x3448f1['data']);return(0x0,l['transformBaseDataToSnapshot'])({},_0x1303fb,_0x1303fb['id'],0x1,_0x5d29c7);}}}function $e(){let _0x339a67={},_0x5e8d8d=[],_0x7ef0c8={'code':c['ErrorCode']['OK'],'message':''},_0x2fcf2f=async(_0x45ed25,_0x40e058)=>{if(!_0x40e058['snapshot'])throw Error('SDK\x20transform\x20attempted\x20to\x20save\x20an\x20empty\x20snapshot');return _0x339a67['snapshot']=_0x40e058['snapshot'],{'error':_0x7ef0c8};};return{'service':{'saveSnapshot':_0x2fcf2f,'updateSnapshot':_0x2fcf2f,'saveSheetBlock':async(_0x303d1a,_0x1de18c)=>{if(!_0x1de18c['block'])throw Error('SDK\x20transform\x20attempted\x20to\x20save\x20an\x20empty\x20block');return _0x5e8d8d['push'](_0x1de18c['block']),{'error':_0x7ef0c8,'blockID':_0x1de18c['block']['id']};}},'sheetBlocks':_0x5e8d8d,get 'snapshot'(){return _0x339a67['snapshot'];}};}function et(_0x5416bd){if(_0x5416bd['type']!==c['UniverType']['UNIVER_SHEET']&&_0x5416bd['type']!==c['UniverType']['UNIVER_BASE'])return[];let _0x51efbc=[],_0x3ff398=new Set();for(let _0x566418 of Object['values'](_0x5416bd['workbook']?.['blockMeta']??{}))for(let _0x40b281 of _0x566418['blocks'])_0x3ff398['has'](_0x40b281)||(_0x3ff398['add'](_0x40b281),_0x51efbc['push'](_0x40b281));return _0x51efbc;}function E(_0x5d6ac6,_0x2676f8,_0x593050){let _0x27a816=new Map(_0x593050['map'](_0x2c7c14=>[_0x2c7c14['objectId'],_0x2c7c14])),_0x2de892=[];for(let _0x28e771 of _0x2676f8){let _0x272f04=_0x27a816['get'](_0x28e771);_0x272f04&&_0x2de892['push']({'unitID':_0x5d6ac6,'objectID':_0x272f04['permissionId'],'objectType':_0x272f04['objectType'],'action':c['UnitAction']['Edit']});}return _0x2de892;}function tt(_0x1d207b,_0x38e1e0,_0x56d23c){if(_0x56d23c==='base.mutation.apply-base-json1'&&st(_0x38e1e0['op']))return nt(_0x1d207b,_0x38e1e0['op']);let _0x1b2c89=new Set(),_0x284181=D(_0x38e1e0,'table'),_0x51445c=typeof _0x38e1e0['tableId']=='string'?_0x38e1e0['tableId']:_0x284181[0x0];if(_0x284181['forEach'](_0x5117de=>_0x1b2c89['add']((0x0,p['getBaseTablePermissionObjectId'])(_0x5117de))),!_0x51445c)return[..._0x1b2c89];let _0x23c63f=_0x1d207b['getSnapshot']()['tables'][_0x51445c],_0x4e6f27=new Set(D(_0x38e1e0,'field')),_0x27dec5=new Set(D(_0x38e1e0,'record')),_0x54153d=new Set(D(_0x38e1e0,'view'));return ot(_0x23c63f,_0x38e1e0['patches'],_0x27dec5,_0x4e6f27),O(_0x38e1e0,_0x4e6f27),_0x4e6f27['forEach'](_0x2ed0aa=>_0x1b2c89['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x51445c,_0x2ed0aa))),_0x27dec5['forEach'](_0x4c5745=>_0x1b2c89['add']((0x0,p['getBaseRecordPermissionObjectId'])(_0x51445c,_0x4c5745))),_0x54153d['forEach'](_0x1e1da6=>_0x1b2c89['add']((0x0,p['getBaseViewPermissionObjectId'])(_0x51445c,_0x1e1da6))),[..._0x1b2c89];}function nt(_0x599a6d,_0x3e1b32){let _0x1d0a98=_0x599a6d['getSnapshot'](),_0x5a706f=new p['BaseJson1OpApplier']()['getAffectedRanges'](_0x3e1b32),_0x1c66e9=rt(_0x3e1b32),_0x32476c=new Set();return _0x5a706f['forEach'](_0x213d2b=>{let {tableId:_0x6e3571}=_0x213d2b;if(!_0x6e3571)return;_0x32476c['add']((0x0,p['getBaseTablePermissionObjectId'])(_0x6e3571));let _0x1ad3b1=_0x1d0a98['tables'][_0x6e3571],_0x581fa8=_0x213d2b['recordId']??(_0x213d2b['row']==null?void 0x0:_0x1ad3b1?.['rowId']?.[_0x213d2b['row']]),_0x157556=_0x213d2b['fieldId']??(_0x213d2b['column']==null?void 0x0:_0x1ad3b1?.['colId']?.[_0x213d2b['column']]);_0x581fa8&&_0x32476c['add']((0x0,p['getBaseRecordPermissionObjectId'])(_0x6e3571,_0x581fa8)),_0x157556&&_0x32476c['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x6e3571,_0x157556)),_0x213d2b['viewId']&&_0x32476c['add']((0x0,p['getBaseViewPermissionObjectId'])(_0x6e3571,_0x213d2b['viewId'])),(_0x213d2b['reason']==='table'||_0x1c66e9['has'](_0x6e3571))&&_0x1ad3b1&&(Object['keys'](_0x1ad3b1['fields'])['forEach'](_0x423fa7=>_0x32476c['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x6e3571,_0x423fa7))),Object['keys'](_0x1ad3b1['records'])['forEach'](_0x46a375=>_0x32476c['add']((0x0,p['getBaseRecordPermissionObjectId'])(_0x6e3571,_0x46a375))),Object['keys'](_0x1ad3b1['views'])['forEach'](_0x954414=>_0x32476c['add']((0x0,p['getBaseViewPermissionObjectId'])(_0x6e3571,_0x954414)))),_0x213d2b['reason']==='record'&&_0x1ad3b1&&Object['keys'](_0x1ad3b1['fields'])['forEach'](_0x55cd14=>_0x32476c['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x6e3571,_0x55cd14)));}),_0x5a706f['length']===0x0&&at(_0x3e1b32,'tableOrder')&&Object['keys'](_0x1d0a98['tables'])['forEach'](_0x18b29c=>_0x32476c['add']((0x0,p['getBaseTablePermissionObjectId'])(_0x18b29c))),[..._0x32476c];}function rt(_0x5bacbe){let _0x2190c7=new Set(),_0xa4731c=_0x24270e=>{Array['isArray'](_0x24270e)&&_0x24270e['forEach']((_0x397a82,_0x2bc934)=>{_0x397a82==='tables'&&typeof _0x24270e[_0x2bc934+0x1]=='string'&&it(_0x24270e[_0x2bc934+0x2])&&_0x2190c7['add'](_0x24270e[_0x2bc934+0x1]),_0xa4731c(_0x397a82);});};return _0xa4731c(_0x5bacbe),_0x2190c7;}function it(_0x2fad85){return!!_0x2fad85&&typeof _0x2fad85=='object'&&!Array['isArray'](_0x2fad85)&&('i'in _0x2fad85||'r'in _0x2fad85||'p'in _0x2fad85||'d'in _0x2fad85||'es'in _0x2fad85||'ena'in _0x2fad85||'et'in _0x2fad85);}function at(_0x19dbac,_0x3c467d){return Array['isArray'](_0x19dbac)&&_0x19dbac['some'](_0x5e7a04=>_0x5e7a04===_0x3c467d||at(_0x5e7a04,_0x3c467d));}function D(_0x2af293,_0x175119){let _0x26fb7a=new Set(),_0x56ecf5=_0x175119+'Id',_0x7ca70e=_0x175119+'Ids',_0x5cdb21=(_0x5fc7e,_0x5c0e6f='')=>{if(typeof _0x5fc7e=='string'){_0x5c0e6f===_0x56ecf5&&_0x26fb7a['add'](_0x5fc7e);return;}if(Array['isArray'](_0x5fc7e)){_0x5c0e6f===_0x7ca70e?_0x5fc7e['forEach'](_0x5658a0=>{typeof _0x5658a0=='string'&&_0x26fb7a['add'](_0x5658a0);}):_0x5fc7e['forEach'](_0x101a85=>_0x5cdb21(_0x101a85,_0x5c0e6f));return;}k(_0x5fc7e)&&Object['entries'](_0x5fc7e)['forEach'](([_0x576ed1,_0x39202b])=>{_0x576ed1==='id'&&_0x5c0e6f===_0x175119&&typeof _0x39202b=='string'?_0x26fb7a['add'](_0x39202b):_0x5cdb21(_0x39202b,_0x576ed1);});};return _0x5cdb21(_0x2af293),[..._0x26fb7a];}function ot(_0x27143c,_0x6f3fc6,_0x252e8a,_0x4b593b){!_0x27143c||!Array['isArray'](_0x6f3fc6)||_0x6f3fc6['forEach'](_0x27a161=>{if(!k(_0x27a161))return;let _0x3d6987=_0x27a161;if(typeof _0x3d6987['row']=='number'){let _0x5d2b03=_0x27143c['rowId']?.[_0x3d6987['row']];_0x5d2b03&&_0x252e8a['add'](_0x5d2b03);}if(typeof _0x3d6987['col']=='number'){let _0x520d86=_0x27143c['colId']?.[_0x3d6987['col']];_0x520d86&&_0x4b593b['add'](_0x520d86);}});}function O(_0x37abb8,_0x23bdf0,_0x2739eb=''){if(!(!_0x37abb8||typeof _0x37abb8!='object')){if(Array['isArray'](_0x37abb8)){_0x37abb8['forEach'](_0x22dcb3=>O(_0x22dcb3,_0x23bdf0,_0x2739eb));return;}k(_0x37abb8)&&Object['entries'](_0x37abb8)['forEach'](([_0x2b8e1a,_0x1822a7])=>{_0x2739eb==='values'&&_0x23bdf0['add'](_0x2b8e1a),O(_0x1822a7,_0x23bdf0,_0x2b8e1a);});}}function st(_0x48f11a){return Array['isArray'](_0x48f11a);}function k(_0x331cd7){return typeof _0x331cd7=='object'&&!!_0x331cd7&&!Array['isArray'](_0x331cd7);}function A(_0x53e8f2,_0x20d33d,_0x6af7d6){let _0x566ddf=_0x53e8f2['get'](u['IResourceManagerService'])['getAllResourceHooks']()['find'](_0x1c8a33=>_0x1c8a33['pluginName']===_0x6af7d6['name']&&_0x1c8a33['businesses']['includes'](_0x6af7d6['business']));if(!_0x566ddf)throw new S('INTERNAL_ERROR',_0x6af7d6['label']+'\x20permission\x20resource\x20is\x20not\x20registered');try{let _0xb04dd8=JSON['parse'](_0x566ddf['toJson'](_0x20d33d));if(!Array['isArray'](_0xb04dd8)||!_0xb04dd8['every'](_0x50f8dc=>ct(_0x50f8dc,_0x6af7d6['objectTypes'])))throw Error('Invalid\x20'+_0x6af7d6['label']+'\x20permission\x20bindings');let _0x418673=new Set();for(let _0x523664 of _0xb04dd8){let _0x4bbc7b=_0x523664['objectType']+'/'+_0x523664['objectId'];if(_0x418673['has'](_0x4bbc7b))throw Error('Duplicate\x20'+_0x6af7d6['label']+'\x20permission\x20binding');_0x418673['add'](_0x4bbc7b);}return _0xb04dd8;}catch(_0x51427a){throw new S('INTERNAL_ERROR','Failed\x20to\x20read\x20'+_0x6af7d6['label']+'\x20permission\x20bindings',{'cause':_0x51427a});}}function ct(_0x1eb4dc,_0x553a7c){if(!_0x1eb4dc||typeof _0x1eb4dc!='object')return!0x1;let _0x240b09=_0x1eb4dc;return typeof _0x240b09['objectId']=='string'&&_0x240b09['objectId']['length']>0x0&&typeof _0x240b09['permissionId']=='string'&&_0x240b09['permissionId']['length']>0x0&&_0x240b09['objectType']!==void 0x0&&_0x553a7c['has'](_0x240b09['objectType']);}var lt={'name':'BASE_OBJECT_PERMISSION_PLUGIN','business':u['UniverInstanceType']['UNIVER_BASE'],'objectTypes':new Set([c['UnitObject']['BaseTable'],c['UnitObject']['BaseField'],c['UnitObject']['BaseRecord'],c['UnitObject']['BaseView'],c['UnitObject']['BaseDashboard']]),'label':'Base'};function ut(_0xfc19fb,_0x2cf4a7){return A(_0xfc19fb,_0x2cf4a7,lt);}var dt=new Set(['base-dashboard.mutation.patch-dashboard','base-dashboard.mutation.remove-dashboard','base-dashboard.mutation.set-dashboard']);function ft(_0x4b3bfa,_0x549c73,_0x16ca18){if(_0x16ca18['id']['startsWith']('thread-comment.mutation.'))return[{'unitID':_0x549c73,'objectID':_0x549c73,'objectType':c['UnitObject']['Base'],'action':c['UnitAction']['Comment']}];let _0x27dba0=_0x16ca18['params'],_0x2b8f9b;if(dt['has'](_0x16ca18['id'])){let _0x27760d=_0x27dba0['dashboard'],_0x470777=typeof _0x27dba0['dashboardId']=='string'?_0x27dba0['dashboardId']:_0x27760d?.['id'];_0x2b8f9b=new Set(typeof _0x470777=='string'?[(0x0,p['getBaseDashboardPermissionObjectId'])(_0x470777)]:[]);}else{if(_0x16ca18['id']['startsWith']('base.mutation.')){let _0x3cdfd3=_0x4b3bfa['get'](u['IUniverInstanceService'])['getUnit'](_0x549c73,u['UniverInstanceType']['UNIVER_BASE']);_0x2b8f9b=new Set(tt(_0x3cdfd3,_0x27dba0,_0x16ca18['id']));}else return[];}return _0x2b8f9b['size']===0x0?[]:E(_0x549c73,_0x2b8f9b,ut(_0x4b3bfa,_0x549c73));}function pt(_0x2c7c88,_0x29261f){let _0x2378ee=typeof _0x29261f?.['subUnitId']=='string'?_0x29261f['subUnitId']:_0x2c7c88['getActivePageId'](),_0x458a3e=_0x2c7c88['getSnapshot']()['pages'][_0x2378ee]?.['elements']??{},_0x22bf91=new Set(mt(_0x29261f)),_0x5801e8=j(_0x29261f);return _0x5801e8['size']&&Object['values'](_0x458a3e)['forEach'](_0x19672b=>{if(!P(_0x19672b)||typeof _0x19672b['id']!='string')return;let _0x55f152=_0x19672b;(_0x5801e8['has'](String(_0x55f152['chartId']??''))||_0x5801e8['has'](String(_0x55f152['tableId']??'')))&&_0x22bf91['add'](_0x55f152['id']);}),[...ht(_0x458a3e,_0x22bf91)]['map'](_0x195ef7=>(0x0,ee['getBoardElementPermissionObjectId'])(_0x2378ee,_0x195ef7));}function mt(_0x2df7c9,_0x453deb=''){let _0x403e14=new Set();return N(_0x2df7c9,_0x453deb,_0x403e14),[..._0x403e14];}function j(_0x3dd230,_0x182f62='',_0x44f352=new Set()){return P(_0x3dd230)?Array['isArray'](_0x3dd230)?(_0x3dd230['forEach'](_0x1aecc8=>j(_0x1aecc8,_0x182f62,_0x44f352)),_0x44f352):(Object['entries'](_0x3dd230)['forEach'](([_0x375ec4,_0x3d5abb])=>{(_0x375ec4==='chartId'||_0x375ec4==='tableId')&&typeof _0x3d5abb=='string'&&_0x44f352['add'](_0x3d5abb),_0x375ec4==='id'&&(_0x182f62==='chart'||_0x182f62==='table')&&typeof _0x3d5abb=='string'&&_0x44f352['add'](_0x3d5abb),j(_0x3d5abb,_0x375ec4,_0x44f352);}),_0x44f352):_0x44f352;}function ht(_0x464e25,_0x75c94f){let _0x1cd0e0=new Set(_0x75c94f),_0x384bd8=Object['values'](_0x464e25)['filter'](P)['filter'](_0x23d923=>typeof _0x23d923['id']=='string'),_0x5eb57c=_0x5e4eab=>{let _0x241472=_0x464e25[_0x5e4eab];!_0x241472||typeof _0x241472!='object'||M(_0x241472,/^(parentId|groupId|parentNodeId|structureScopeId)$/i)['forEach'](_0x470824=>{_0x1cd0e0['has'](_0x470824)||!_0x464e25[_0x470824]||(_0x1cd0e0['add'](_0x470824),_0x5eb57c(_0x470824));});};_0x75c94f['forEach'](_0x5eb57c);let _0x403182=new Set(_0x75c94f),_0x2e15cf=!0x0;for(;_0x2e15cf;)_0x2e15cf=!0x1,_0x384bd8['forEach'](_0x4a1d0e=>{_0x403182['has'](_0x4a1d0e['id'])||M(_0x4a1d0e,/(?:parent|group|child|owner|root|start|end|from|to|bound|structureScope).*(?:Id|Ids)$/i)['some'](_0x5704b0=>_0x403182['has'](_0x5704b0))&&(_0x403182['add'](_0x4a1d0e['id']),_0x1cd0e0['add'](_0x4a1d0e['id']),_0x2e15cf=!0x0);});return _0x1cd0e0;}function M(_0x1ed28c,_0x26982d,_0x4d1724='',_0x592663=new Set()){return typeof _0x1ed28c=='string'?(_0x26982d['test'](_0x4d1724)&&_0x592663['add'](_0x1ed28c),[..._0x592663]):Array['isArray'](_0x1ed28c)?(_0x26982d['test'](_0x4d1724)?_0x1ed28c['forEach'](_0x58b4bc=>{typeof _0x58b4bc=='string'&&_0x592663['add'](_0x58b4bc);}):_0x1ed28c['forEach'](_0x220ced=>M(_0x220ced,_0x26982d,_0x4d1724,_0x592663)),[..._0x592663]):(P(_0x1ed28c)&&Object['entries'](_0x1ed28c)['forEach'](([_0xaa8c65,_0x320a36])=>M(_0x320a36,_0x26982d,_0xaa8c65,_0x592663)),[..._0x592663]);}function N(_0x1280a1,_0xffe8ac,_0x483c40){if(typeof _0x1280a1=='string'){/^(elementId|drawingId|connectorId|containerId|swimlaneId|[a-z]*nodeId)$/i['test'](_0xffe8ac)&&_0x483c40['add'](_0x1280a1);return;}if(Array['isArray'](_0x1280a1)){/^(element|drawing|connector|container|swimlane|[a-z]*node)Ids$/i['test'](_0xffe8ac)?_0x1280a1['forEach'](_0x2501fb=>{typeof _0x2501fb=='string'&&_0x483c40['add'](_0x2501fb);}):_0x1280a1['forEach'](_0x31f4ba=>N(_0x31f4ba,_0xffe8ac,_0x483c40));return;}P(_0x1280a1)&&Object['entries'](_0x1280a1)['forEach'](([_0x13fb04,_0x69689a])=>{_0x13fb04==='id'&&(_0xffe8ac==='element'||_0xffe8ac==='elements')?typeof _0x69689a=='string'&&_0x483c40['add'](_0x69689a):N(_0x69689a,_0x13fb04,_0x483c40);});}function P(_0x2bd1ad){return typeof _0x2bd1ad=='object'&&!!_0x2bd1ad&&!Array['isArray'](_0x2bd1ad);}var gt={'name':'BOARD_OBJECT_PERMISSION_PLUGIN','business':u['UniverInstanceType']['UNIVER_BOARD'],'objectTypes':new Set([c['UnitObject']['BoardElement']]),'label':'Board'};function _t(_0x4553bf,_0x35bcf8){return A(_0x4553bf,_0x35bcf8,gt);}function vt(_0x19bf8c,_0x5f23af,_0x2c3415){if(_0x2c3415['id']['startsWith']('thread-comment.mutation.'))return[{'unitID':_0x5f23af,'objectID':_0x5f23af,'objectType':c['UnitObject']['Board'],'action':c['UnitAction']['Comment']}];if(!_0x2c3415['id']['startsWith']('board.mutation.'))return[];let _0x388601=_0x2c3415['params'];if(_0x2c3415['id']==='board.mutation.update-element'&&_0x388601['formulaLastValueGuard'])return[];let _0x152e21=_0x19bf8c['get'](u['IUniverInstanceService'])['getUnit'](_0x5f23af,u['UniverInstanceType']['UNIVER_BOARD']),_0x111a0e=new Set(pt(_0x152e21,_0x388601));return _0x111a0e['size']===0x0?[]:E(_0x5f23af,_0x111a0e,_t(_0x19bf8c,_0x5f23af));}var yt=['defaultHeaderId','defaultFooterId','firstPageHeaderId','firstPageFooterId','evenPageHeaderId','evenPageFooterId'],bt=new WeakMap();function F(_0x1db05b){let _0x4ac3ab=_0x1db05b['getMutationRevision']?.()??NaN,_0x25b69d=bt['get'](_0x1db05b);if(_0x25b69d?.['mutationRevision']===_0x4ac3ab)return _0x25b69d;let _0x4ec1ad=_0x1db05b['getSnapshot'](),_0xe5e20=_0x4ec1ad['body']?(0x0,m['getTopLevelSectionBreaks'])(_0x4ec1ad['body']):[],_0xa6e4ae=new Map(),_0x26f7a3=(_0x34af3a,_0x39dafe)=>{for(let _0x7741eb of _0x34af3a?.['customBlocks']??[])_0xa6e4ae['has'](_0x7741eb['blockId'])||_0xa6e4ae['set'](_0x7741eb['blockId'],_0x39dafe);};_0x26f7a3(_0x4ec1ad['body'],''),Object['entries'](_0x4ec1ad['headers']??{})['forEach'](([_0x4dac68,_0x319419])=>_0x26f7a3(_0x319419['body'],_0x4dac68)),Object['entries'](_0x4ec1ad['footers']??{})['forEach'](([_0x5087e7,_0x2530c])=>_0x26f7a3(_0x2530c['body'],_0x5087e7)),Object['entries'](_0x4ec1ad['notes']??{})['forEach'](([_0x3fdf6b,_0x4776b1])=>_0x26f7a3(_0x4776b1['body'],_0x3fdf6b));let _0x9adf56=new Map();for(let _0x4d45d9 of _0x4ec1ad['body']?.['customRanges']??[])(_0x4d45d9['rangeType']===u['CustomRangeType']['FOOTNOTE']||_0x4d45d9['rangeType']===u['CustomRangeType']['ENDNOTE'])&&typeof _0x4d45d9['properties']?.['noteId']=='string'&&_0x9adf56['set'](_0x4d45d9['properties']['noteId'],{'startOffset':_0x4d45d9['startIndex'],'endOffset':_0x4d45d9['endIndex']+0x1});let _0xc34d85={'drawingSegmentIds':_0xa6e4ae,'footnoteReferenceRanges':_0x9adf56,'mutationRevision':_0x4ac3ab,'segments':new Map(),'topLevelSections':_0xe5e20};return bt['set'](_0x1db05b,_0xc34d85),_0xc34d85;}function xt(_0x25e582,_0x44d3e0,_0xc10d81=F(_0x25e582)){let _0x3560a6=_0xc10d81['segments']['get'](_0x44d3e0);if(_0x3560a6)return _0x3560a6;let _0x47656a=_0x25e582['getSelfOrHeaderFooterModel'](_0x44d3e0)?.['getBody']()??null,_0x57dde9=_0x25e582['getSnapshot'](),_0x588526=_0x57dde9['notes']?.[_0x44d3e0],_0x27b519=(_0x588526?_0x588526['drawings']:_0x57dde9['drawings'])??{},_0x8a1f0e=_0x47656a==null?[]:[...(_0x47656a['tables']??[])['map'](_0xb1de8b=>({'type':'table','id':_0xb1de8b['tableId'],'startOffset':_0xb1de8b['startIndex'],'endOffset':_0xb1de8b['endIndex']})),...(_0x47656a['customBlocks']??[])['map'](_0x1d364d=>({'type':_0x27b519[_0x1d364d['blockId']]?'drawing':'custom-block','id':_0x1d364d['blockId'],'startOffset':_0x1d364d['startIndex'],'endOffset':_0x1d364d['startIndex']+0x1})),...(_0x47656a['blockRanges']??[])['map'](_0x544021=>({'type':'block-range','id':_0x544021['blockId'],'startOffset':_0x544021['startIndex'],'endOffset':_0x544021['endIndex']+0x1})),...(_0x47656a['customRanges']??[])['map'](_0x3d07c4=>({'type':'custom-range','id':_0x3d07c4['rangeId'],'startOffset':_0x3d07c4['startIndex'],'endOffset':_0x3d07c4['endIndex']+0x1})),...(_0x47656a['columnGroups']??[])['map'](_0x2c5def=>({'type':'column-group','id':_0x2c5def['columnGroupId'],'startOffset':_0x2c5def['startIndex'],'endOffset':_0x2c5def['endIndex']+0x1}))],_0x2b10d3=new Map(_0x8a1f0e['map'](_0x27751e=>[_0x27751e['type']+':'+_0x27751e['id'],{'startOffset':_0x27751e['startOffset'],'endOffset':_0x27751e['endOffset']}]));for(let _0x38d7dc of _0x47656a?.['customBlocks']??[]){let _0x2d89b4={'startOffset':_0x38d7dc['startIndex'],'endOffset':_0x38d7dc['startIndex']+0x1};_0x2b10d3['set']('custom-block:'+_0x38d7dc['blockId'],_0x2d89b4),_0x2b10d3['set']('drawing:'+_0x38d7dc['blockId'],_0x2d89b4);}let _0x8d9d38={'body':_0x47656a,'entities':_0x8a1f0e,'entityRanges':_0x2b10d3,'paragraphContentStartOffsets':_0x47656a==null?new Map():(0x0,u['getParagraphContentStartOffsets'])(_0x47656a),'paragraphsById':new Map((_0x47656a?.['paragraphs']??[])['filter'](_0x29de69=>_0x29de69['paragraphId']!=null)['map'](_0x4de082=>[_0x4de082['paragraphId'],_0x4de082]))};return _0xc10d81['segments']['set'](_0x44d3e0,_0x8d9d38),_0x8d9d38;}function St(_0x450526,_0x5ad261){return F(_0x450526)['drawingSegmentIds']['get'](_0x5ad261)??'';}function Ct(_0x142c15,_0x553b8c,_0x4ced45){let _0x3b7978=F(_0x142c15),_0x3bc082=xt(_0x142c15,_0x553b8c,_0x3b7978),{body:_0x790217}=_0x3bc082;return _0x790217?[...L(_0x142c15,_0x553b8c,_0x4ced45,_0x3b7978),...Ot(_0x790217,_0x553b8c,_0x4ced45,_0x3bc082),...kt(_0x553b8c,_0x4ced45,_0x3bc082)]:[];}function wt(_0x1e22ea,_0xce2a06,_0x795be4){let _0xb64503=new Set();if(_0x795be4==null)return[];let _0x22f9c5=u['JSON1']['type']['readCursor'](_0x795be4);return _0x22f9c5['traverse'](null,()=>{let _0x27396d=_0x22f9c5['getPath'](),_0x1e305f=_0x22f9c5['getComponent'](),_0x4d9590=['headers','footers','notes']['includes'](String(_0x27396d[0x0]))&&typeof _0x27396d[0x1]=='string'?_0x27396d[0x1]:_0xce2a06;if(_0x27396d[0x0]==='notes'&&typeof _0x27396d[0x1]=='string'&&L(_0x1e22ea,_0x27396d[0x1],{'startOffset':0x0,'endOffset':0x0})['forEach'](_0x567da9=>_0xb64503['add'](_0x567da9)),_0x27396d[0x0]==='noteSettings'&&F(_0x1e22ea)['topLevelSections']['forEach'](_0x56c6f7=>{_0xb64503['add']((0x0,m['getDocumentSectionPermissionObjectId'])('',_0x56c6f7['sectionId']));}),_0x27396d[0x0]==='body'&&_0x27396d[0x1]==='sectionBreaks'&&typeof _0x27396d[0x2]=='number'&&(_0x27396d[0x3]==='noteProperties'||_0x27396d[0x3]==='suppressEndnotes')){let _0x4db21f=_0x1e22ea['getBody']()?.['sectionBreaks']?.[_0x27396d[0x2]]?.['sectionId'];_0x4db21f&&_0xb64503['add']((0x0,m['getDocumentSectionPermissionObjectId'])('',_0x4db21f));}if(_0x27396d[_0x27396d['length']-0x1]!=='body'||_0x1e305f?.['et']!==u['TextX']['id']||!Array['isArray'](_0x1e305f['e'])||!_0x1e305f['e']['every'](Et))return;let _0xa1cf63=_0x1e305f['e'],_0x35814b=0x0,_0x4e43d9=(_0x1f6de5,_0x336a9a)=>{Ct(_0x1e22ea,_0x4d9590,{'startOffset':_0x1f6de5,'endOffset':_0x336a9a})['forEach'](_0x2a6b6d=>_0xb64503['add'](_0x2a6b6d));};_0xa1cf63['forEach'](_0x375fef=>{if(_0x375fef['t']===u['TextXActionType']['INSERT']){_0x4e43d9(_0x35814b,_0x35814b);return;}if(_0x375fef['t']===u['TextXActionType']['DELETE']){_0x4e43d9(_0x35814b,_0x35814b+_0x375fef['len']),_0x35814b+=_0x375fef['len'];return;}(_0x375fef['body']!==void 0x0||_0x375fef['oldBody']!==void 0x0||_0x375fef['coverType']!==void 0x0)&&_0x4e43d9(_0x35814b,_0x35814b+_0x375fef['len']),_0x35814b+=_0x375fef['len'];});}),Tt(_0x795be4)['forEach'](_0x50f11c=>{_0xb64503['add']((0x0,m['getDocumentEntityPermissionObjectId'])(_0xce2a06,'drawing',_0x50f11c));let _0x307840=(_0x1e22ea['getSelfOrHeaderFooterModel'](_0xce2a06)?.['getBody']())?.['customBlocks']?.['find'](_0x30fc72=>_0x30fc72['blockId']===_0x50f11c);_0x307840&&L(_0x1e22ea,_0xce2a06,{'startOffset':_0x307840['startIndex'],'endOffset':_0x307840['startIndex']+0x1})['forEach'](_0x5f438b=>_0xb64503['add'](_0x5f438b));}),[..._0xb64503];}function Tt(_0x4f812d){let _0x424a26=new Set(),_0xce0156=_0x2ba4fc=>{if(Array['isArray'](_0x2ba4fc)){_0x2ba4fc['forEach']((_0x51ad5e,_0x331bb0)=>{_0x51ad5e==='drawings'&&typeof _0x2ba4fc[_0x331bb0+0x1]=='string'&&_0x424a26['add'](_0x2ba4fc[_0x331bb0+0x1]),_0xce0156(_0x51ad5e);});return;}I(_0x2ba4fc)&&Object['values'](_0x2ba4fc)['forEach'](_0xce0156);};return _0xce0156(_0x4f812d),[..._0x424a26];}function Et(_0x3fa75a){return!I(_0x3fa75a)||typeof _0x3fa75a['len']!='number'?!0x1:_0x3fa75a['t']===u['TextXActionType']['INSERT']?I(_0x3fa75a['body']):_0x3fa75a['t']===u['TextXActionType']['RETAIN']||_0x3fa75a['t']===u['TextXActionType']['DELETE'];}function I(_0x14b81b){return typeof _0x14b81b=='object'&&!!_0x14b81b&&!Array['isArray'](_0x14b81b);}function Dt(_0x1db753,_0x386910,_0x5d5d81,_0x40fd54){let _0x57eee4=F(_0x1db753),_0x1d6ad2=xt(_0x1db753,_0x386910,_0x57eee4)['entityRanges']['get'](_0x5d5d81+':'+_0x40fd54)??null;return _0x1d6ad2?L(_0x1db753,_0x386910,_0x1d6ad2,_0x57eee4):[];}function L(_0x209862,_0x57c30c,_0x19fd56,_0x527e5b=F(_0x209862)){if(_0x57c30c){let _0x1f9804=_0x527e5b['footnoteReferenceRanges']['get'](_0x57c30c);return _0x1f9804?Ct(_0x209862,'',_0x1f9804):jt(_0x209862,_0x57c30c,_0x527e5b['topLevelSections'])['map'](_0x8d13d5=>(0x0,m['getDocumentSectionPermissionObjectId'])('',_0x8d13d5));}return At(_0x527e5b['topLevelSections'],_0x19fd56)['map'](_0x1ab6f0=>(0x0,m['getDocumentSectionPermissionObjectId'])('',_0x1ab6f0['sectionId']));}function Ot(_0x463f2e,_0x5a49ce,_0x5a582b,_0x537f0f){let _0x43d87a=Math['min'](_0x5a582b['startOffset'],_0x5a582b['endOffset']),_0x43e76b=Math['max'](_0x5a582b['startOffset'],_0x5a582b['endOffset']);return(_0x463f2e['paragraphs']??[])['filter'](_0x47abb3=>R(_0x537f0f['paragraphContentStartOffsets']['get'](_0x47abb3['startIndex'])??(0x0,u['getParagraphContentStartOffset'])(_0x463f2e,_0x47abb3),_0x47abb3['startIndex']+0x1,_0x43d87a,_0x43e76b))['flatMap'](_0x2d2ac7=>_0x2d2ac7['paragraphId']?[(0x0,m['getDocumentParagraphPermissionObjectId'])(_0x5a49ce,_0x2d2ac7['paragraphId'])]:[]);}function kt(_0x3530bd,_0x4d7338,_0x55f656){let _0x38f55d=Math['min'](_0x4d7338['startOffset'],_0x4d7338['endOffset']),_0x531eb9=Math['max'](_0x4d7338['startOffset'],_0x4d7338['endOffset']);return _0x55f656['entities']['filter'](_0x39f731=>R(_0x39f731['startOffset'],_0x39f731['endOffset'],_0x38f55d,_0x531eb9))['map'](_0x3b43d2=>(0x0,m['getDocumentEntityPermissionObjectId'])(_0x3530bd,_0x3b43d2['type'],_0x3b43d2['id']));}function At(_0x272dbf,_0x1d78f9){let _0x47a4ba=Math['min'](_0x1d78f9['startOffset'],_0x1d78f9['endOffset']),_0x16aab6=Math['max'](_0x1d78f9['startOffset'],_0x1d78f9['endOffset']);return _0x272dbf['filter']((_0x4665fe,_0x176fef)=>R(_0x176fef===0x0?0x0:_0x272dbf[_0x176fef-0x1]['startIndex']+0x1,_0x4665fe['startIndex']+0x1,_0x47a4ba,_0x16aab6));}function R(_0x18fd96,_0x4f2442,_0x21e5ea,_0x3a2a95){return _0x21e5ea===_0x3a2a95?_0x21e5ea>=_0x18fd96&&_0x21e5ea<_0x4f2442:_0x21e5ea<_0x4f2442&&_0x3a2a95>_0x18fd96;}function jt(_0x2908ac,_0x1ee51b,_0x479ba9=F(_0x2908ac)['topLevelSections']){let _0x3fc241=_0x2908ac['getSnapshot'](),_0x4df4=new Set();return _0x479ba9['forEach']((_0x38a927,_0x1bd561)=>{yt['some'](_0x57620d=>(0x0,u['resolveSectionHeaderFooterReference'])(_0x3fc241['documentStyle'],_0x479ba9,_0x1bd561,_0x57620d)['segmentId']===_0x1ee51b)&&_0x4df4['add'](_0x38a927['sectionId']);}),[..._0x4df4];}function Mt(_0x22ea04,_0x3c6cd0){let _0x118cab=z(_0x3c6cd0['params'])?_0x3c6cd0['params']:void 0x0;if(_0x3c6cd0['id']===m['RichTextEditingMutation']['id']){let _0x34cc2c=_0x3c6cd0['params'];return wt(_0x22ea04,_0x34cc2c['segmentId']??'',_0x34cc2c['actions']);}return _0x3c6cd0['id']==='doc.mutation.rename-doc'||_0x3c6cd0['id']==='docs-formula.mutation.set-last-values'||_0x3c6cd0['id']==='doc.mutation.update-shape-data'&&_0x118cab?.['formulaLastValueGuard']?[]:Nt(_0x22ea04,_0x3c6cd0);}function Nt(_0xb1fa25,_0x533623){let _0x400ad3=_0x533623['params'];if(!z(_0x400ad3))return[];let _0x5b65c1=new Set(),_0x47bec4=(_0x2571f4,_0x4a5eb6,_0x4f1d35)=>{_0x5b65c1['add']((0x0,m['getDocumentEntityPermissionObjectId'])(_0x2571f4,_0x4a5eb6,_0x4f1d35)),Dt(_0xb1fa25,_0x2571f4,_0x4a5eb6,_0x4f1d35)['forEach'](_0x4d6d06=>_0x5b65c1['add'](_0x4d6d06));};return Pt(_0x400ad3)['forEach'](({entityType:_0x3bed86,entityId:_0xe8fba9})=>{let _0x1920ab=_0x400ad3['segmentId'],_0x57549e=typeof _0x1920ab=='string'?_0x1920ab:_0x3bed86==='drawing'||_0x3bed86==='custom-block'?St(_0xb1fa25,_0xe8fba9):'';_0x47bec4(_0x57549e,_0x3bed86,_0xe8fba9);}),[..._0x5b65c1];}function Pt(_0x416006){let _0x4845d9=new Map(),_0xd6da28={'blockId':['custom-block'],'drawingId':['drawing'],'shapeId':['drawing','custom-block'],'tableId':['table'],'rangeId':['custom-range'],'columnGroupId':['column-group']},_0x164244=(_0x44d721,_0x19ca5b='')=>{if(typeof _0x44d721=='string'){_0xd6da28[_0x19ca5b]?.['forEach'](_0x53ec81=>{_0x4845d9['set'](_0x53ec81+'\x1f'+_0x44d721,{'entityType':_0x53ec81,'entityId':_0x44d721});});return;}if(Array['isArray'](_0x44d721)){let _0x49f56a=_0x19ca5b['endsWith']('Ids')?_0x19ca5b['slice'](0x0,-0x3)+'Id':_0x19ca5b;_0x44d721['forEach'](_0x179184=>_0x164244(_0x179184,_0x49f56a));return;}z(_0x44d721)&&Object['entries'](_0x44d721)['forEach'](([_0x49351b,_0x507b5a])=>_0x164244(_0x507b5a,_0x49351b));};return _0x164244(_0x416006),[..._0x4845d9['values']()];}function z(_0x3ce602){return typeof _0x3ce602=='object'&&!!_0x3ce602&&!Array['isArray'](_0x3ce602);}var Ft={'name':'DOC_OBJECT_PERMISSION_PLUGIN','business':u['UniverInstanceType']['UNIVER_DOC'],'objectTypes':new Set([c['UnitObject']['DocumentSection'],c['UnitObject']['DocumentParagraph'],c['UnitObject']['DocumentEntity']]),'label':'Document'};function It(_0x3be8db,_0x287de4){return A(_0x3be8db,_0x287de4,Ft);}function Lt(_0x44d653,_0x2ba0de,_0x7c5fa7){if(_0x7c5fa7['id']['startsWith']('thread-comment.mutation.'))return[{'unitID':_0x2ba0de,'objectID':_0x2ba0de,'objectType':c['UnitObject']['Document'],'action':c['UnitAction']['Comment']}];let _0x5d4a08=_0x44d653['get'](u['IUniverInstanceService'])['getUnit'](_0x2ba0de,u['UniverInstanceType']['UNIVER_DOC']),_0x26cb8d=new Set(Mt(_0x5d4a08,_0x7c5fa7));return _0x26cb8d['size']===0x0?[]:E(_0x2ba0de,_0x26cb8d,It(_0x44d653,_0x2ba0de));}function Rt(_0x45d6c7){let {startRow:_0xd300e2,startColumn:_0x43059c,endRow:_0x4ccef9,endColumn:_0x5baf74,rangeType:_0x4358b5}=_0x45d6c7;return(Number['isNaN'](_0xd300e2)||[u['RANGE_TYPE']['ALL'],u['RANGE_TYPE']['COLUMN']]['includes'](_0x4358b5))&&(_0x45d6c7['startRow']=0x0),(Number['isNaN'](_0x4ccef9)||[u['RANGE_TYPE']['ALL'],u['RANGE_TYPE']['COLUMN']]['includes'](_0x4358b5))&&(_0x45d6c7['endRow']=u['MAX_ROW_COUNT']-0x1),(Number['isNaN'](_0x43059c)||[u['RANGE_TYPE']['ALL'],u['RANGE_TYPE']['ROW']]['includes'](_0x4358b5))&&(_0x45d6c7['startColumn']=0x0),(Number['isNaN'](_0x5baf74)||[u['RANGE_TYPE']['ALL'],u['RANGE_TYPE']['ROW']]['includes'](_0x4358b5))&&(_0x45d6c7['endColumn']=u['MAX_COLUMN_COUNT']-0x1),_0x45d6c7;}function zt(_0x4be933,_0x50e440){return[new h['WorkbookEditablePermission'](_0x4be933),new h['WorksheetEditPermission'](_0x4be933,_0x50e440)];}function B(_0x346d55,_0x3b6206){return _0x346d55['get'](u['IUniverInstanceService'])['getUnitType'](_0x3b6206)===u['UniverInstanceType']['UNIVER_SHEET'];}function V(_0x194b36,_0x4e1396,_0x5b5226,_0x34bb6a,_0x9e1750){let _0x587942=[];_0x9e1750['workbookTypes']?.['forEach'](_0x190388=>{_0x587942['push'](new _0x190388(_0x4e1396));}),_0x9e1750['worksheetTypes']?.['forEach'](_0x221781=>{_0x587942['push'](new _0x221781(_0x4e1396,_0x5b5226));});let _0x9ea08c=_0x34bb6a['map'](_0x26eed2=>Rt({..._0x26eed2})),_0x3ba046=_0x194b36['get'](h['RangeProtectionRuleModel'])['getSubunitRuleList'](_0x4e1396,_0x5b5226)['filter'](_0x96bb4f=>_0x96bb4f['ranges']['some'](_0x1ba665=>_0x9ea08c['some'](_0x10b860=>u['Rectangle']['intersects'](_0x1ba665,_0x10b860))));return _0x9e1750['rangeTypes']?.['forEach'](_0x43886d=>{_0x3ba046['forEach'](_0x47cf75=>{_0x587942['push'](new _0x43886d(_0x4e1396,_0x5b5226,_0x47cf75['permissionId']));});}),_0x587942;}function H(_0x1041a7,_0x2823d0){return _0x2823d0['map'](_0x1497fd=>new _0x1497fd(_0x1041a7));}var Bt=[{'id':g['AddConditionalRuleMutation']['id'],'handle'(_0x1fa4f9,_0x46df18){let {params:_0xac46f7}=_0x46df18;return V(_0x1fa4f9,_0xac46f7['unitId'],_0xac46f7['subUnitId'],_0xac46f7['rule']['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':_['AddDataValidationMutation']['id'],'handle'(_0x3b2d7c,_0x9b10d6){let {unitId:_0x1d071e,subUnitId:_0x221e1c}=_0x9b10d6['params'];if(!B(_0x3b2d7c,_0x1d071e))return[];let _0x28d887=[];return Array['isArray'](_0x9b10d6['params']['rule'])?_0x9b10d6['params']['rule']['forEach'](_0x380705=>{_0x28d887['push'](..._0x380705['ranges']);}):_0x28d887['push'](..._0x9b10d6['params']['rule']['ranges']),V(_0x3b2d7c,_0x1d071e,_0x221e1c,_0x28d887,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['AddRangeProtectionMutation']['id'],'handle'(_0xb4a365,_0x1ba1da){let {params:_0x170f16}=_0x1ba1da,{unitId:_0x3191c3}=_0x170f16;return[new h['WorkbookCreateProtectPermission'](_0x3191c3)];}},{'id':h['AddWorksheetMergeMutation']['id'],'handle'(_0x17691e,_0x468669){let {params:_0x178193}=_0x468669;return V(_0x17691e,_0x178193['unitId'],_0x178193['subUnitId'],_0x178193['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission'],h['WorksheetSetCellValuePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':g['DeleteConditionalRuleMutation']['id'],'handle'(_0x5828d5,_0x5f5059){let {params:_0x5be118}=_0x5f5059,_0x1aef7f=_0x5828d5['get'](g['ConditionalFormattingRuleModel'])['getRule'](_0x5be118['unitId'],_0x5be118['subUnitId'],_0x5be118['cfId']);return _0x1aef7f?V(_0x5828d5,_0x5be118['unitId'],_0x5be118['subUnitId'],_0x1aef7f['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]}):[];}},{'id':h['DeleteRangeProtectionMutation']['id'],'handle'(_0x4e6254,_0x461ee6){let {params:_0x1d5dc1}=_0x461ee6,{unitId:_0x49129c,subUnitId:_0x7ab89a,ruleIds:_0x2978e3}=_0x1d5dc1,_0x16a63a=_0x4e6254['get'](h['RangeProtectionRuleModel']),_0x1a7e09=[];for(let _0x2093a8 of _0x2978e3){let _0x534532=_0x16a63a['getRule'](_0x49129c,_0x7ab89a,_0x2093a8);if(!_0x534532)return!0x1;_0x1a7e09['push'](new h['RangeProtectionPermissionDeleteProtectionPoint'](_0x49129c,_0x7ab89a,_0x534532['permissionId']));}return _0x1a7e09;}},{'id':h['DeleteWorksheetProtectionMutation']['id'],'handle'(_0x107870,_0xd92de9){let {params:_0x5cca68}=_0xd92de9,{unitId:_0x18ff56,subUnitId:_0x33fe93}=_0x5cca68;return[new h['WorksheetDeleteProtectionPermission'](_0x18ff56,_0x33fe93)];}},{'id':h['ToggleGridlinesMutation']['id'],'handle'(_0x4c9364,_0x51f264){let {params:_0x442bf9}=_0x51f264;return[new h['WorkbookEditablePermission'](_0x442bf9['unitId']),new h['WorksheetEditPermission'](_0x442bf9['unitId'],_0x442bf9['subUnitId'])];}},{'id':h['InsertColMutation']['id'],'handle'(_0x303d38,_0xfa6cb9){let {params:_0x4a8814}=_0xfa6cb9,_0x2124b2={..._0x4a8814['range']};return _0x2124b2['rangeType']=u['RANGE_TYPE']['COLUMN'],V(_0x303d38,_0x4a8814['unitId'],_0x4a8814['subUnitId'],[_0x2124b2],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetInsertColumnPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['InsertRowMutation']['id'],'handle'(_0x2e8108,_0x50f39d){let {params:_0x2511e9}=_0x50f39d,_0x55b36f={..._0x2511e9['range']};return _0x55b36f['rangeType']=u['RANGE_TYPE']['ROW'],V(_0x2e8108,_0x2511e9['unitId'],_0x2511e9['subUnitId'],[_0x55b36f],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetInsertRowPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['InsertSheetMutation']['id'],'handle'(_0x4a1389,_0x3fcdfd){let {params:_0x3f87e9}=_0x3fcdfd;return H(_0x3f87e9['unitId'],[h['WorkbookCreateSheetPermission']]);}},{'id':h['MoveColsMutation']['id'],'handle'(_0x8928bc,_0x3f4857){let {params:_0x1eb066}=_0x3f4857,_0x5df854={..._0x1eb066['sourceRange']};_0x5df854['rangeType']=u['RANGE_TYPE']['COLUMN'];let _0x483a1a={..._0x1eb066['targetRange']};return _0x483a1a['rangeType']=u['RANGE_TYPE']['COLUMN'],V(_0x8928bc,_0x1eb066['unitId'],_0x1eb066['subUnitId'],[_0x5df854,_0x483a1a],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':g['MoveConditionalRuleMutation']['id'],'handle'(_0x1b2000,_0x5c8d63){let {params:_0x393d26}=_0x5c8d63;return zt(_0x393d26['unitId'],_0x393d26['subUnitId']);}},{'id':h['MoveRangeMutation']['id'],'handle'(_0x56a00d,_0x43e692){let {params:_0x301e7c}=_0x43e692,_0x5e044a=new u['ObjectMatrix'](_0x301e7c['from']['value'])['getDataRange'](),_0x4b689e=new u['ObjectMatrix'](_0x301e7c['to']['value'])['getDataRange']();return V(_0x56a00d,_0x301e7c['unitId'],_0x301e7c['from']['subUnitId'],[_0x5e044a,_0x4b689e],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['MoveRowsMutation']['id'],'handle'(_0x4a20c7,_0x3e5dc8){let {params:_0x1b6ddd}=_0x3e5dc8,_0x2b399d={..._0x1b6ddd['sourceRange']};_0x2b399d['rangeType']=u['RANGE_TYPE']['ROW'];let _0x2dc6c5={..._0x1b6ddd['targetRange']};return _0x2dc6c5['rangeType']=u['RANGE_TYPE']['ROW'],V(_0x4a20c7,_0x1b6ddd['unitId'],_0x1b6ddd['subUnitId'],[_0x2b399d,_0x2dc6c5],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveColMutation']['id'],'handle'(_0x5c5285,_0x2eec37){let {params:_0x4ecfc0}=_0x2eec37,_0x15dc3c={..._0x4ecfc0['range']};return _0x15dc3c['rangeType']=u['RANGE_TYPE']['COLUMN'],V(_0x5c5285,_0x4ecfc0['unitId'],_0x4ecfc0['subUnitId'],[_0x15dc3c],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetDeleteColumnPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':_['RemoveDataValidationMutation']['id'],'handle'(_0x50ea57,_0x284866){let {unitId:_0x320146,subUnitId:_0x2eee59,ruleId:_0x55639a}=_0x284866['params'];if(!B(_0x50ea57,_0x320146))return[];let _0x42b823=_0x50ea57['get'](_['DataValidationModel']),_0x1d354d=(Array['isArray'](_0x55639a)?_0x55639a:[_0x55639a])['map'](_0x5262ff=>_0x42b823['getRuleById'](_0x320146,_0x2eee59,_0x5262ff)),_0x1d54f=[];return _0x1d354d['forEach'](_0x5ebf37=>{_0x5ebf37?.['ranges']&&_0x1d54f['push'](..._0x5ebf37['ranges']);}),V(_0x50ea57,_0x320146,_0x2eee59,_0x1d54f,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveNumfmtMutation']['id'],'handle'(_0x399dae,_0x2321e2){let {params:_0x25e469}=_0x2321e2,{ranges:_0x1dd560}=_0x25e469;return V(_0x399dae,_0x25e469['unitId'],_0x25e469['subUnitId'],_0x1dd560,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveRowMutation']['id'],'handle'(_0x4abed1,_0x29c200){let {params:_0x38972f}=_0x29c200,_0x327199={..._0x38972f['range']};return _0x327199['rangeType']=u['RANGE_TYPE']['ROW'],V(_0x4abed1,_0x38972f['unitId'],_0x38972f['subUnitId'],[_0x327199],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetDeleteRowPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveSheetMutation']['id'],'handle'(_0x545bf7,_0x1800a7){let {params:_0x1677f5}=_0x1800a7;return H(_0x1677f5['unitId'],[h['WorkbookDeleteSheetPermission']]);}},{'id':te['RemoveSheetsFilterMutation']['id'],'handle'(_0x3922a2,_0x220869){let {params:_0x58400d}=_0x220869;return V(_0x3922a2,_0x58400d['unitId'],_0x58400d['subUnitId'],[],{'worksheetTypes':[h['WorksheetViewPermission']],'rangeTypes':[h['RangeProtectionPermissionViewPoint']]});}},{'id':h['RemoveWorksheetMergeMutation']['id'],'handle'(_0x2125d8,_0x59ce8f){let {params:_0x339585}=_0x59ce8f;return V(_0x2125d8,_0x339585['unitId'],_0x339585['subUnitId'],_0x339585['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission'],h['WorksheetSetCellValuePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['ReorderRangeMutation']['id'],'handle'(_0x22b1db,_0x375d71){let {params:_0x103fce}=_0x375d71,{range:_0x389c49}=_0x103fce;return V(_0x22b1db,_0x103fce['unitId'],_0x103fce['subUnitId'],[_0x389c49],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetSortPermission'],h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['SetWorksheetColWidthMutation']['id'],'handle'(_0x36a8e0,_0x22b114){let {params:_0x58e497}=_0x22b114,_0x22f2e6=[..._0x58e497['ranges']]['map'](_0x5c3152=>{let _0x1fcc56={..._0x5c3152};return _0x1fcc56['rangeType']=u['RANGE_TYPE']['COLUMN'],_0x1fcc56;});return V(_0x36a8e0,_0x58e497['unitId'],_0x58e497['subUnitId'],_0x22f2e6,{'worksheetTypes':[h['WorksheetSetColumnStylePermission']]});}},{'id':g['SetConditionalRuleMutation']['id'],'handle'(_0x7978e6,_0x1e5a24){let {params:_0x5c4491}=_0x1e5a24,_0x42417a=_0x7978e6['get'](g['ConditionalFormattingRuleModel'])['getRule'](_0x5c4491['unitId'],_0x5c4491['subUnitId'],_0x5c4491['cfId']||_0x5c4491['rule']['cfId']);return[..._0x42417a?V(_0x7978e6,_0x5c4491['unitId'],_0x5c4491['subUnitId'],_0x42417a['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]}):[],...V(_0x7978e6,_0x5c4491['unitId'],_0x5c4491['subUnitId'],_0x5c4491['rule']['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]})];}},{'id':h['SetNumfmtMutation']['id'],'handle'(_0x2eba68,_0x3e50ad){let {params:_0x2b589b}=_0x3e50ad,{values:_0x4f93fd}=_0x2b589b,_0x3fc928=[];return Object['keys'](_0x4f93fd)['forEach'](_0x55ffca=>{let _0x345fb2=_0x4f93fd[_0x55ffca];_0x3fc928['push'](..._0x345fb2['ranges']);}),V(_0x2eba68,_0x2b589b['unitId'],_0x2b589b['subUnitId'],_0x3fc928,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['SetRangeProtectionMutation']['id'],'handle'(_0x2d5628,_0x3b8c56){let {params:_0x4c5143}=_0x3b8c56,{unitId:_0x5e5c94,subUnitId:_0x57d748,ruleId:_0xde87db}=_0x4c5143,_0x5e1ad0=_0x2d5628['get'](h['RangeProtectionRuleModel'])['getRule'](_0x5e5c94,_0x57d748,_0xde87db);return _0x5e1ad0?[new h['RangeProtectionPermissionManageCollaPoint'](_0x5e5c94,_0x57d748,_0x5e1ad0['permissionId'])]:[];}},{'id':h['SetRangeValuesMutation']['id'],'handle'(_0x1a88b9,_0x290213){let {params:_0x2b8a16}=_0x290213,_0xc0bb2d=new u['ObjectMatrix'](_0x2b8a16['cellValue']),_0x2c0b3e=[new h['WorkbookEditablePermission'](_0x2b8a16['unitId']),new h['WorksheetEditPermission'](_0x2b8a16['unitId'],_0x2b8a16['subUnitId'])],_0x4303f0=_0x1a88b9['get'](h['RangeProtectionRuleModel'])['getSubunitRuleList'](_0x2b8a16['unitId'],_0x2b8a16['subUnitId']);return _0xc0bb2d['forValue']((_0x4fe305,_0x5a2a35)=>{_0x4303f0['filter'](_0x15d0b5=>_0x15d0b5['ranges']['some'](_0x151ec4=>_0x4fe305>=_0x151ec4['startRow']&&_0x4fe305<=_0x151ec4['endRow']&&_0x5a2a35>=_0x151ec4['startColumn']&&_0x5a2a35<=_0x151ec4['endColumn']))['forEach'](_0x19fc20=>{_0x2c0b3e['push'](new h['RangeProtectionPermissionEditPoint'](_0x2b8a16['unitId'],_0x2b8a16['subUnitId'],_0x19fc20['permissionId']));});}),_0x2c0b3e;}},{'id':h['SetWorksheetRowAutoHeightMutation']['id'],'handle'(_0x5b7c90,_0x2d0262){let {params:_0x48f1c6}=_0x2d0262,_0x265852=_0x48f1c6['rowsAutoHeightInfo']['map'](_0x2b373d=>{let _0x18a512={'startColumn':0x0,'endColumn':0x0,'startRow':_0x2b373d['row'],'endRow':_0x2b373d['row']};return _0x18a512['rangeType']=u['RANGE_TYPE']['ROW'],_0x18a512;});return V(_0x5b7c90,_0x48f1c6['unitId'],_0x48f1c6['subUnitId'],_0x265852,{'worksheetTypes':[h['WorksheetSetRowStylePermission']]});}},{'id':h['SetWorksheetRowHeightMutation']['id'],'handle'(_0x5776f1,_0x30842e){let {params:_0x3f4945}=_0x30842e,_0x2ac69f=[..._0x3f4945['ranges']]['map'](_0xa26b15=>{let _0x3ccac7={..._0xa26b15};return _0x3ccac7['rangeType']=u['RANGE_TYPE']['ROW'],_0x3ccac7;});return V(_0x5776f1,_0x3f4945['unitId'],_0x3f4945['subUnitId'],_0x2ac69f,{'worksheetTypes':[h['WorksheetSetRowStylePermission']]});}},{'id':h['SetWorksheetHideMutation']['id'],'handle'(_0x542933,_0x4a6f04){let {params:_0x51af20}=_0x4a6f04;return H(_0x51af20['unitId'],[h['WorkbookHideSheetPermission']]);}},{'id':h['SetWorksheetNameMutation']['id'],'handle'(_0x10987a,_0x4ec358){let {params:_0x58cc25}=_0x4ec358;return H(_0x58cc25['unitId'],[h['WorkbookRenameSheetPermission']]);}},{'id':h['SetWorksheetOrderMutation']['id'],'handle'(_0x301054,_0x2f30d9){let {params:_0x21f962}=_0x2f30d9;return H(_0x21f962['unitId'],[h['WorkbookMoveSheetPermission']]);}},{'id':te['SetSheetsFilterRangeMutation']['id'],'handle'(_0x147cab,_0x5c7a3a){let {params:_0x2149d6}=_0x5c7a3a;return V(_0x147cab,_0x2149d6['unitId'],_0x2149d6['subUnitId'],[_0x2149d6['range']],{'worksheetTypes':[h['WorksheetViewPermission']],'rangeTypes':[h['RangeProtectionPermissionViewPoint']]});}},{'id':h['SetWorksheetProtectionMutation']['id'],'handle'(_0x503eda,_0x38bc4c){let {params:_0x3ae0c1}=_0x38bc4c,{unitId:_0x48d486,subUnitId:_0x25d45b}=_0x3ae0c1;return[new h['WorksheetManageCollaboratorPermission'](_0x48d486,_0x25d45b)];}},{'id':_['UpdateDataValidationMutation']['id'],'handle'(_0x1c0a65,_0x5acac2){let {unitId:_0x2fa2cc,subUnitId:_0x171f15,ruleId:_0x10d9c1,payload:_0xf6e5a4}=_0x5acac2['params'];if(!B(_0x1c0a65,_0x2fa2cc))return[];let _0x3a1299=_0x1c0a65['get'](_['DataValidationModel']),_0x319763=(Array['isArray'](_0x10d9c1)?_0x10d9c1:[_0x10d9c1])['map'](_0x31c44f=>_0x3a1299['getRuleById'](_0x2fa2cc,_0x171f15,_0x31c44f)),_0x83cfe7=[];return _0x319763['forEach'](_0x11e69e=>{_0x11e69e?.['ranges']&&_0x83cfe7['push'](..._0x11e69e['ranges']);}),_0xf6e5a4['type']===_['UpdateRuleType']['RANGE']&&_0x83cfe7['push'](..._0xf6e5a4['payload']),V(_0x1c0a65,_0x2fa2cc,_0x171f15,_0x83cfe7,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}}];function Vt(_0x26c691,_0x187d6d,_0x21f1f8){let _0x2258da=_0x21f1f8;if(_0x2258da['unitId']!==_0x187d6d)throw U('Permission\x20point\x20identifies\x20another\x20Unit');switch(_0x2258da['type']){case c['UnitObject']['Workbook']:return{'objectID':_0x187d6d,'objectType':_0x2258da['type'],'action':_0x2258da['subType']};case c['UnitObject']['Worksheet']:return Ht(_0x26c691,_0x187d6d,_0x2258da);case c['UnitObject']['SelectRange']:if(!_0x2258da['permissionId'])throw U('Range\x20permission\x20point\x20has\x20no\x20object\x20ID');return{'objectID':_0x2258da['permissionId'],'objectType':_0x2258da['type'],'action':_0x2258da['subType']};default:throw U('Unsupported\x20Sheet\x20permission\x20point\x20type');}}function Ht(_0x2b5112,_0x1fa055,_0x4d01d5){if(!_0x4d01d5['subUnitId'])throw U('Worksheet\x20permission\x20point\x20has\x20no\x20subUnit\x20ID');let _0x8b0e36;if(h['baseProtectionActions']['includes'](_0x4d01d5['subType'])?_0x8b0e36=_0x2b5112['get'](h['WorksheetProtectionRuleModel'])['getRule'](_0x1fa055,_0x4d01d5['subUnitId'])?.['permissionId']:h['defaultWorksheetPermissionPoint']['includes'](_0x4d01d5['subType'])&&(_0x8b0e36=_0x2b5112['get'](h['WorksheetProtectionPointModel'])['getRule'](_0x1fa055,_0x4d01d5['subUnitId'])?.['permissionId']),_0x8b0e36)return{'objectID':_0x8b0e36,'objectType':c['UnitObject']['Worksheet'],'action':_0x4d01d5['subType']};}function U(_0x22f65c){return new S('INVALID_REQUEST',_0x22f65c);}var Ut=new Map(Bt['map'](_0x4b9ac8=>[_0x4b9ac8['id'],_0x4b9ac8]));function Wt(_0x666c1a,_0x52a1bb,_0xad6438){let _0x7ee0b7=Ut['get'](_0xad6438['id']);if(!_0x7ee0b7)return[];let _0x232536=_0x7ee0b7['handle'](_0x666c1a,_0xad6438);if(_0x232536===!0x1)throw new S('INVALID_REQUEST','Mutation\x20permission\x20analysis\x20failed\x20for\x20'+_0xad6438['id']);let _0x145816=[];for(let _0xaa3e94 of _0x232536){let _0x525e05=Vt(_0x666c1a,_0x52a1bb,_0xaa3e94);_0x525e05&&_0x145816['push']({'unitID':_0x52a1bb,..._0x525e05});}return _0x145816;}var Gt={'name':'SLIDE_OBJECT_PERMISSION_PLUGIN','business':u['UniverInstanceType']['UNIVER_SLIDE'],'objectTypes':new Set([c['UnitObject']['SlidePage'],c['UnitObject']['SlideElement'],c['UnitObject']['SlideMaster']]),'label':'Slide'};function Kt(_0x3a44d5,_0x50d0fb){return A(_0x3a44d5,_0x50d0fb,Gt);}var qt=class{['model'];['resourceService'];['targets']=new Set();constructor(_0x5966dd,_0x54b853){this['model']=_0x5966dd,this['resourceService']=_0x54b853;}['collect'](_0x3b2e73){return this['_checkChartMutation'](_0x3b2e73),this['targets'];}['add'](_0x4007df){for(let _0x4e57fd of _0x4007df)this['targets']['add'](_0x4e57fd);}['_checkChartMutation'](_0x98fcf4){switch(_0x98fcf4['id']){case y['RemoveSlideChartDataSourceMutation']['id']:{let _0x30b9a5=_0x98fcf4['params'];return _0x30b9a5&&this['_assertDataSource'](_0x30b9a5['unitId'],_0x30b9a5['dataSourceId']),!0x0;}case y['RemoveSlideChartSnapshotMutation']['id']:{let _0x58b5ed=_0x98fcf4['params'];return _0x58b5ed&&this['_assertChart'](_0x58b5ed['unitId'],_0x58b5ed['chartId']),!0x0;}case y['SetSlideChartDataSourceMutation']['id']:{let _0x4cc5c1=_0x98fcf4['params'];return _0x4cc5c1&&this['_assertDataSource'](_0x4cc5c1['unitId'],_0x4cc5c1['dataSource']['id']),!0x0;}case y['SetSlideChartSnapshotMutation']['id']:{let _0x3c5677=_0x98fcf4['params'];return _0x3c5677&&this['_assertChart'](_0x3c5677['unitId'],_0x3c5677['chart']['id']),!0x0;}default:return!0x1;}}['_getSlideModel'](_0x5ceee5){return _0x5ceee5===this['model']['getUnitId']()?this['model']:void 0x0;}['_assertDataSource'](_0x4a68d4,_0x567fb7){let _0x326dcf=this['resourceService']['getChartIdsByDataSource'](_0x4a68d4,_0x567fb7);this['_assertCharts'](_0x4a68d4,_0x326dcf);}['_assertChart'](_0xeac29,_0x5dfdd0){this['_assertCharts'](_0xeac29,[_0x5dfdd0]);}['_assertCharts'](_0x589b78,_0x13ed88){let _0x2172a5=this['_getSlideModel'](_0x589b78);if(!_0x2172a5)return;let _0x5535f7=new Set(_0x13ed88),_0x91b1d4=(0x0,b['resolveMatchingSlideElementPermissionObjectIds'])(_0x2172a5,_0xa60cb9=>_0xa60cb9['type']===b['PageElementTypeEnum']['Chart']&&_0x5535f7['has'](_0xa60cb9['chartId']));this['add'](_0x91b1d4);}['_assertPage'](_0x2f63aa,_0x540075,_0x3be9d0){if(_0x3be9d0){this['_assertElement'](_0x2f63aa,_0x540075,_0x3be9d0);return;}let _0x475528=this['_getSlideModel'](_0x2f63aa);if(!_0x475528)return;let _0x2f9740=(0x0,b['getSlidePageType'])(_0x475528,_0x540075),_0x2741bf=[];_0x2f9740===b['PageTypeEnum']['Slide']?_0x2741bf['push']((0x0,b['getSlidePagePermissionObjectId'])(_0x540075)):(_0x2f9740===b['PageTypeEnum']['Master']||_0x2f9740===b['PageTypeEnum']['Layout'])&&_0x2741bf['push'](b['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']),this['add'](_0x2741bf);}['_assertElement'](_0x36f0d0,_0x32ca39,_0x1ae39a){let _0x3970ce=this['_getSlideModel'](_0x36f0d0);if(!_0x3970ce)return;let _0x3d2a3f=(0x0,b['getSlidePageType'])(_0x3970ce,_0x32ca39)??b['PageTypeEnum']['Slide'],_0xc6755e=new Set();(0x0,b['addSlideElementPermissionObjectIds'])(_0x3970ce,_0x32ca39,_0x3d2a3f,new Set([_0x1ae39a]),_0xc6755e),this['add'](_0xc6755e);}},Jt=class{['model'];['targets']=new Set();constructor(_0x27673b){this['model']=_0x27673b;}['collect'](_0x4398be){return this['_checkPresentationMutation'](_0x4398be),this['_checkPageMutation'](_0x4398be),this['_checkElementMutation'](_0x4398be),this['_checkDrawingMutation'](_0x4398be),this['targets'];}['add'](_0x35f115){for(let _0x3aef4f of _0x35f115)this['targets']['add'](_0x3aef4f);}['_checkPresentationMutation'](_0x114a67){switch(_0x114a67['id']){case b['EnsureSlideMasterPageMutation']['id']:{let _0x8ee1fe=_0x114a67['params'];return _0x8ee1fe&&this['_assertPageSnapshot'](_0x8ee1fe['unitId'],_0x8ee1fe['masterPage']),!0x0;}case'slide.mutation.set-name':{let _0x5dea0b=_0x114a67['params'];return _0x5dea0b&&this['_assertUnit'](_0x5dea0b['unitId']),!0x0;}case b['SetSlidePageSizeMutation']['id']:{let _0x56639c=_0x114a67['params'];return _0x56639c&&this['_assertOptionalPage'](_0x56639c['unitId'],_0x56639c['pageId']),!0x0;}case b['SetPresentationBackgroundGraphicsMutation']['id']:{let _0x32b97f=_0x114a67['params'];return _0x32b97f&&this['_assertMasterView'](_0x32b97f['unitId']),!0x0;}case b['SetSlideTransitionMutation']['id']:{let _0x3b6589=_0x114a67['params'];return _0x3b6589&&this['_assertPages'](_0x3b6589['unitId'],Object['keys'](_0x3b6589['slideTransitionRefs']??{})),!0x0;}default:return!0x1;}}['_checkPageMutation'](_0x32bed9){switch(_0x32bed9['id']){case b['AddSlidePageMutation']['id']:{let _0x5d8330=_0x32bed9['params'];return _0x5d8330&&this['_assertPageSnapshot'](_0x5d8330['unitId'],_0x5d8330['slide']),!0x0;}case b['MoveSlidePageMutation']['id']:{let _0x253065=_0x32bed9['params'];return _0x253065&&this['_assertPage'](_0x253065['unitId'],_0x253065['subUnitId']),!0x0;}case b['RemoveSlidePageMutation']['id']:{let _0x1a7786=_0x32bed9['params'];return _0x1a7786&&this['_assertPageWithElements'](_0x1a7786['unitId'],_0x1a7786['subUnitId']),!0x0;}case'slide.mutation.set-slide-placeholder-suppression':{let _0x1324ef=_0x32bed9['params'];return _0x1324ef&&this['_assertPage'](_0x1324ef['unitId'],_0x1324ef['subUnitId']),!0x0;}case b['SetSlideSpeakerNotesMutation']['id']:{let _0x4d9498=_0x32bed9['params'];return _0x4d9498&&this['_assertPage'](_0x4d9498['unitId'],_0x4d9498['subUnitId']),!0x0;}case b['UpdateSlidePageBackgroundMutation']['id']:{let _0x5872aa=_0x32bed9['params'];return _0x5872aa&&this['_assertPage'](_0x5872aa['unitId'],_0x5872aa['pageId']),!0x0;}default:return!0x1;}}['_checkElementMutation'](_0x49ec63){switch(_0x49ec63['id']){case b['AddSlideElementMutation']['id']:{let _0x30ece9=_0x49ec63['params'];return _0x30ece9&&this['_assertElements'](_0x30ece9['unitId'],_0x30ece9['subUnitId'],[_0x30ece9['element']['id']],_0x30ece9['sourcePageType']),!0x0;}case b['InsertDrawingObjectMutation']['id']:{let _0x3c21b0=_0x49ec63['params'];return _0x3c21b0?.['drawings']['forEach'](_0xdc4f93=>this['_assertElements'](_0x3c21b0['unitId'],_0x3c21b0['subUnitId'],[_0xdc4f93['drawingId']],_0xdc4f93['sourcePageType'])),!0x0;}case b['RemoveSlideElementMutation']['id']:{let _0x37f47a=_0x49ec63['params'];return _0x37f47a&&this['_assertElements'](_0x37f47a['unitId'],_0x37f47a['subUnitId'],[_0x37f47a['drawingId']]),!0x0;}case b['UpdateSlideElementMutation']['id']:{let _0x301d7b=_0x49ec63['params'];return _0x301d7b&&!_0x301d7b['formulaLastValueGuard']&&this['_assertElements'](_0x301d7b['unitId'],_0x301d7b['subUnitId'],[_0x301d7b['drawingId']]),!0x0;}default:return!0x1;}}['_checkDrawingMutation'](_0x4c3975){switch(_0x4c3975['id']){case b['SetSlideDrawingApplyMutation']['id']:{let _0x2b2011=_0x4c3975['params'];return _0x2b2011&&this['_assertElements'](_0x2b2011['unitId'],_0x2b2011['subUnitId'],_0x2b2011['objects']['map'](_0x2dd772=>_0x2dd772['drawingId'])),!0x0;}case b['SetSlideElementOrderMutation']['id']:{let _0x53b716=_0x4c3975['params'];return _0x53b716&&this['_assertElements'](_0x53b716['unitId'],_0x53b716['subUnitId'],_0x53b716['drawingIds']),!0x0;}case b['SetSlideGroupMutation']['id']:{let _0x23df1c=_0x4c3975['params'];return _0x23df1c&&this['_assertElements'](_0x23df1c['unitId'],_0x23df1c['subUnitId'],_0x23df1c['drawingIds']),!0x0;}case b['CancelSlideGroupMutation']['id']:{let _0xdca7e9=_0x4c3975['params'];return _0xdca7e9&&this['_assertElements'](_0xdca7e9['unitId'],_0xdca7e9['subUnitId'],_0xdca7e9['drawingIds']),!0x0;}default:return!0x1;}}['_getSlideModel'](_0x1a432b){return _0x1a432b===this['model']['getUnitId']()?this['model']:void 0x0;}['_assertUnit'](_0x67b660){this['_getSlideModel'](_0x67b660)&&this['add']([]);}['_assertOptionalPage'](_0x4385bf,_0x313e58){if(_0x313e58){this['_assertPage'](_0x4385bf,_0x313e58);return;}this['_assertUnit'](_0x4385bf);}['_assertPage'](_0x3b912a,_0x27dd7a,_0x5720d9){let _0x57edd4=this['_getSlideModel'](_0x3b912a);if(!_0x57edd4)return;let _0xf5a1a3=_0x5720d9??(0x0,b['getSlidePageType'])(_0x57edd4,_0x27dd7a),_0x519378=new Set();this['_addPageTarget'](_0x27dd7a,_0xf5a1a3,_0x519378),this['add'](_0x519378);}['_assertPages'](_0x28cb8d,_0x3fc515){let _0x3a20fe=this['_getSlideModel'](_0x28cb8d);if(!_0x3a20fe)return;let _0x582fa6=new Set();_0x3fc515['forEach'](_0x56489c=>this['_addPageTarget'](_0x56489c,(0x0,b['getSlidePageType'])(_0x3a20fe,_0x56489c),_0x582fa6)),this['add'](_0x582fa6);}['_assertPageWithElements'](_0x39a4c8,_0x34bdd7){let _0x5c19be=this['_getSlideModel'](_0x39a4c8);if(!_0x5c19be)return;let _0x199569=_0x5c19be['getSnapshot']()['slides'][_0x34bdd7],_0xf91e7a=new Set();this['_addPageTarget'](_0x34bdd7,(0x0,b['getSlidePageType'])(_0x5c19be,_0x34bdd7),_0xf91e7a),(0x0,b['addSlideElementPermissionObjectIds'])(_0x5c19be,_0x34bdd7,b['PageTypeEnum']['Slide'],new Set(Object['keys'](_0x199569?.['elements']??{})),_0xf91e7a),this['add'](_0xf91e7a);}['_assertElements'](_0x82140e,_0x561077,_0xc4f39f,_0x4e284e){let _0x92dec3=this['_getSlideModel'](_0x82140e);if(!_0x92dec3)return;let _0xbe3cae=_0x4e284e??(0x0,b['getSlidePageType'])(_0x92dec3,_0x561077)??b['PageTypeEnum']['Slide'],_0x354ecc=new Set();(0x0,b['addSlideElementPermissionObjectIds'])(_0x92dec3,_0x561077,_0xbe3cae,new Set(_0xc4f39f),_0x354ecc),this['add'](_0x354ecc);}['_assertMasterView'](_0x3fc197){this['_getSlideModel'](_0x3fc197)&&this['add']([b['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']]);}['_assertPageSnapshot'](_0x26aa76,_0x3767da){if(!this['_getSlideModel'](_0x26aa76))return;let _0x5cc960=new Set();this['_addPageTarget'](_0x3767da['id'],_0x3767da['pageType'],_0x5cc960),Object['keys'](_0x3767da['elements'])['forEach'](_0x30f3f4=>{_0x5cc960['add']((0x0,b['getSlideElementPermissionObjectId'])(_0x3767da['pageType'],_0x3767da['id'],_0x30f3f4));}),this['add'](_0x5cc960);}['_addPageTarget'](_0x55ce3f,_0x17f498,_0x1d8a40){_0x17f498===b['PageTypeEnum']['Master']||_0x17f498===b['PageTypeEnum']['Layout']?_0x1d8a40['add'](b['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']):_0x17f498===b['PageTypeEnum']['Slide']&&_0x1d8a40['add']((0x0,b['getSlidePagePermissionObjectId'])(_0x55ce3f));}},Yt=class{['model'];['targets']=new Set();constructor(_0x2c30a6){this['model']=_0x2c30a6;}['collect'](_0x5beb02){return this['_checkTableMutation'](_0x5beb02),this['targets'];}['add'](_0x16a1f1){for(let _0xdfc968 of _0x16a1f1)this['targets']['add'](_0xdfc968);}['_checkTableMutation'](_0x384659){switch(_0x384659['id']){case x['RemoveSlideTableMutation']['id']:{let _0x20f918=_0x384659['params'];return _0x20f918&&this['_assertTable'](_0x20f918['unitId'],_0x20f918['tableId']),!0x0;}case x['SetSlideTableMutation']['id']:{let _0x32a217=_0x384659['params'];return _0x32a217&&this['_assertTable'](_0x32a217['unitId'],_0x32a217['table']['id']),!0x0;}default:return!0x1;}}['_getSlideModel'](_0x121f21){return _0x121f21===this['model']['getUnitId']()?this['model']:void 0x0;}['_assertTable'](_0x36c9ee,_0xb78a72,_0xda6ff1,_0x2704ce){if(_0xda6ff1&&_0x2704ce){this['_assertElement'](_0x36c9ee,_0xda6ff1,_0x2704ce);return;}let _0x13424f=this['_getSlideModel'](_0x36c9ee);if(!_0x13424f)return;let _0x35fcaf=(0x0,b['resolveMatchingSlideElementPermissionObjectIds'])(_0x13424f,_0x5eb421=>_0x5eb421['type']===b['PageElementTypeEnum']['Table']&&_0x5eb421['tableId']===_0xb78a72);this['add'](_0x35fcaf);}['_assertPage'](_0x26e151,_0x1365af,_0x3fd6fd){if(_0x3fd6fd){this['_assertElement'](_0x26e151,_0x1365af,_0x3fd6fd);return;}let _0xa5fe4=this['_getSlideModel'](_0x26e151);if(!_0xa5fe4)return;let _0x49c85c=(0x0,b['getSlidePageType'])(_0xa5fe4,_0x1365af),_0x2a1241=[];_0x49c85c===b['PageTypeEnum']['Slide']?_0x2a1241['push']((0x0,b['getSlidePagePermissionObjectId'])(_0x1365af)):(_0x49c85c===b['PageTypeEnum']['Master']||_0x49c85c===b['PageTypeEnum']['Layout'])&&_0x2a1241['push'](b['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']),this['add'](_0x2a1241);}['_assertElement'](_0x178423,_0x36652a,_0x39a1f2){let _0x5e19e3=this['_getSlideModel'](_0x178423);if(!_0x5e19e3)return;let _0x461a8d=(0x0,b['getSlidePageType'])(_0x5e19e3,_0x36652a)??b['PageTypeEnum']['Slide'],_0x36311c=new Set();(0x0,b['addSlideElementPermissionObjectIds'])(_0x5e19e3,_0x36652a,_0x461a8d,new Set([_0x39a1f2]),_0x36311c),this['add'](_0x36311c);}},Xt=new Set([v['AddCommentMutation']['id'],v['DeleteCommentMutation']['id'],v['ResolveCommentMutation']['id'],v['UpdateCommentMutation']['id'],v['UpdateCommentRefMutation']['id']]);function Zt(_0x3957f5,_0x4f0f6a,_0x381725){if(Xt['has'](_0x381725['id']))return[{'unitID':_0x4f0f6a,'objectID':_0x4f0f6a,'objectType':c['UnitObject']['Slide'],'action':c['UnitAction']['Comment']}];let _0x32c223=_0x3957f5['get'](u['IUniverInstanceService'])['getUnit'](_0x4f0f6a,u['UniverInstanceType']['UNIVER_SLIDE']),_0xda10c4=new Set([...new Jt(_0x32c223)['collect'](_0x381725),...new qt(_0x32c223,_0x3957f5['get'](y['SlideChartResourceService']))['collect'](_0x381725),...new Yt(_0x32c223)['collect'](_0x381725)]);return _0xda10c4['size']===0x0?[]:E(_0x4f0f6a,_0xda10c4,Kt(_0x3957f5,_0x4f0f6a));}var Qt={[c['UniverType']['UNIVER_SHEET']]:c['UnitObject']['Workbook'],[c['UniverType']['UNIVER_DOC']]:c['UnitObject']['Document'],[c['UniverType']['UNIVER_SLIDE']]:c['UnitObject']['Slide'],[c['UniverType']['UNIVER_BOARD']]:c['UnitObject']['Board'],[c['UniverType']['UNIVER_BASE']]:c['UnitObject']['Base']},$t=class{['_handle'];['_requirements']=new Map();['_injector'];constructor(_0x26dbbc,_0x26ebe1){this['_handle']=_0x26ebe1,this['_injector']=_0x26dbbc['__getInjector']();}['collect'](_0x148b01){let {unitID:_0x465703,type:_0xf4110e}=this['_handle'],_0x584bf0=_0x148b01['params'];if(_0x584bf0?.['unitId']!==void 0x0&&_0x584bf0['unitId']!==_0x465703)throw new S('INVALID_REQUEST','Mutation\x20identifies\x20another\x20Unit');let _0x2e21cc=Qt[_0xf4110e];if(_0x2e21cc!==void 0x0){this['_add']({'unitID':_0x465703,'objectID':_0x465703,'objectType':_0x2e21cc,'action':c['UnitAction']['Edit']});for(let _0x4ed2f7 of this['_collectUnitPermissions'](_0x148b01))this['_add'](_0x4ed2f7);}}['finish'](){return[...this['_requirements']['values']()];}['_collectUnitPermissions'](_0x571882){let {unitID:_0x8bf721,type:_0x3e5eae}=this['_handle'];switch(_0x3e5eae){case c['UniverType']['UNIVER_SHEET']:return Wt(this['_injector'],_0x8bf721,_0x571882);case c['UniverType']['UNIVER_DOC']:return Lt(this['_injector'],_0x8bf721,_0x571882);case c['UniverType']['UNIVER_SLIDE']:return Zt(this['_injector'],_0x8bf721,_0x571882);case c['UniverType']['UNIVER_BOARD']:return vt(this['_injector'],_0x8bf721,_0x571882);case c['UniverType']['UNIVER_BASE']:return ft(this['_injector'],_0x8bf721,_0x571882);default:return[];}}['_add'](_0x16ded3){let {unitID:_0x3f7103,objectID:_0x55198e,objectType:_0x594e61,action:_0x1fc32a}=_0x16ded3,_0x5430aa=JSON['stringify']([_0x3f7103,_0x55198e,_0x594e61,_0x1fc32a]);this['_requirements']['set'](_0x5430aa,_0x16ded3);}},en=class{['_transformService'];constructor(_0x9ce6dd){this['_transformService']=_0x9ce6dd;}['parseClient'](_0x538453){try{return(0x0,l['parseProtocolChangeset'])(structuredClone(_0x538453));}catch(_0x1857d7){throw new S('INVALID_REQUEST','Changeset\x20is\x20malformed',{'cause':_0x1857d7});}}['transform'](_0x3779c6,_0x511b29){let _0x7b7522;try{_0x7b7522=_0x511b29['map'](_0x2ad772=>(0x0,l['parseProtocolChangeset'])(structuredClone(_0x2ad772)));}catch(_0xd60fba){throw new S('ADAPTER_FAILURE','Stored\x20changeset\x20cannot\x20be\x20parsed',{'retryable':!0x0,'cause':_0xd60fba});}let _0xcad24f=_0x3779c6;if(_0x7b7522['length']>0x0){let _0x13e469=this['_transformService']['transformChangesets'](_0x7b7522,[_0x3779c6],!0x1);if((0x0,l['isTransformChangesetsFailure'])(_0x13e469)||!_0x13e469['c2Prime'][0x0])throw new S('OT_CONFLICT','Changeset\x20cannot\x20be\x20transformed',{'cause':(0x0,l['isTransformChangesetsFailure'])(_0x13e469)?_0x13e469['error']:void 0x0});_0xcad24f=_0x13e469['c2Prime'][0x0];}try{return(0x0,l['parseChangesetToProtocol'])(_0xcad24f);}catch(_0x3b2b8c){throw new S('INTERNAL_ERROR','Transformed\x20changeset\x20cannot\x20be\x20serialized',{'retryable':!0x0,'cause':_0x3b2b8c});}}},tn=new WeakSet();function nn(_0x4c9a0a){if(!tn['has'](_0x4c9a0a)){for(let _0x2d8725 of[rn,an])_0x4c9a0a['hasCommand'](_0x2d8725['id'])&&_0x4c9a0a['unregisterCommand'](_0x2d8725['id']),_0x4c9a0a['registerCommand'](_0x2d8725);tn['add'](_0x4c9a0a);}}var rn={'id':'doc.mutation.rich-text-editing','type':u['CommandType']['MUTATION'],'handler'(_0x17efa8,_0x3b2c00){let _0x26ef50=_0x17efa8['get'](u['IUniverInstanceService'])['getUnit'](_0x3b2c00['unitId'],u['UniverInstanceType']['UNIVER_DOC']);if(!_0x26ef50)return!0x1;if(!_0x3b2c00['actions']||u['JSONX']['isNoop'](_0x3b2c00['actions']))return!0x0;let _0x2bc24f=_0x26ef50['getSnapshot'](),_0x1b527b=u['JSONX']['invertWithDoc'](_0x3b2c00['actions'],_0x2bc24f);_0x26ef50['apply'](_0x3b2c00['actions']);let _0x3b7541=(0x0,l['validateDocumentAfterApply'])(_0x26ef50['getSnapshot']());if(!_0x3b7541['ok'])throw _0x26ef50['apply'](_0x1b527b),Error('Invalid\x20Doc\x20mutation\x20result:\x20'+_0x3b7541['errors']['join']('\x20'));return!0x0;}},an={'id':'doc.mutation.rename-doc','type':u['CommandType']['MUTATION'],'handler'(_0x49745d,_0x5cc688){if(!_0x5cc688)return!0x1;let _0x3ffda3=_0x49745d['get'](u['IUniverInstanceService'])['getUnit'](_0x5cc688['unitId'],u['UniverInstanceType']['UNIVER_DOC']);return _0x3ffda3?(_0x3ffda3['setName'](_0x5cc688['name']),!0x0):!0x1;}},on={'code':c['ErrorCode']['OK'],'message':''},sn=class{['_reader'];['_contexts']=new WeakMap();['_capture']=new ne['AsyncLocalStorage']();constructor(_0x5d1e71){this['_reader']=_0x5d1e71;}['createContext'](_0x4ecf0b,_0x21ee40){let _0x5ce093={};return this['_contexts']['set'](_0x5ce093,{'databaseContext':_0x4ecf0b,..._0x21ee40?{'snapshot':_0x21ee40}:{}}),_0x5ce093;}async['capture'](_0x271bac){let _0x54a07b={'sheetBlocks':[]};return{'result':await this['_capture']['run'](_0x54a07b,_0x271bac),..._0x54a07b['snapshot']?{'snapshot':_0x54a07b['snapshot']}:{},'sheetBlocks':_0x54a07b['sheetBlocks']};}async['getUnitOnRev'](_0x24aea0,_0x14d42e){let _0x308555=this['_requireBinding'](_0x24aea0),_0x13ecb8=_0x308555['snapshot']?.['unitID']===_0x14d42e['unitID']&&_0x308555['snapshot']['type']===_0x14d42e['type']&&_0x308555['snapshot']['rev']===_0x14d42e['revision']?_0x308555['snapshot']:await this['_database'](()=>this['_reader']['getSnapshot'](_0x308555['databaseContext'],_0x14d42e['unitID'],{'revision':_0x14d42e['revision']}));if(!_0x13ecb8)throw G('Stored\x20Unit\x20snapshot\x20is\x20missing');if(_0x13ecb8['unitID']!==_0x14d42e['unitID']||_0x13ecb8['type']!==_0x14d42e['type']||!Number['isSafeInteger'](_0x13ecb8['rev'])||_0x13ecb8['rev']<0x1||_0x13ecb8['rev']>_0x14d42e['revision']||!cn(_0x13ecb8))throw G('Stored\x20Unit\x20snapshot\x20is\x20invalid');let _0x5b072f=await this['_database'](()=>this['_reader']['getChangesets'](_0x308555['databaseContext'],_0x14d42e['unitID'],{'from':_0x13ecb8['rev'],'to':_0x14d42e['revision']}));if(_0x5b072f===null)throw G('Stored\x20Unit\x20is\x20unavailable');return ln(_0x14d42e,_0x13ecb8,_0x5b072f),{'error':void 0x0,'snapshot':_0x13ecb8,'changesets':[..._0x5b072f]};}async['getSheetBlock'](_0xce908e,_0x5bf25a){let _0x25b75e=await this['_database'](()=>this['_reader']['getSheetBlock'](this['_requireContext'](_0xce908e),_0x5bf25a['unitID'],_0x5bf25a['blockID']));if(!_0x25b75e)throw G('Stored\x20Sheet\x20block\x20'+_0x5bf25a['blockID']+'\x20is\x20missing');return{'error':void 0x0,'block':_0x25b75e};}['getDeserializedSheetBlock'](_0x5827b5,_0x401d1f){return this['getSheetBlock'](_0x5827b5,_0x401d1f);}async['fetchMissingChangesets'](_0x493ad0,_0x187ef4){let _0x4b0c3c=await this['_database'](()=>this['_reader']['getChangesets'](this['_requireContext'](_0x493ad0),_0x187ef4['unitID'],{'from':_0x187ef4['from'],..._0x187ef4['to']===0x0?{}:{'to':_0x187ef4['to']}}));if(_0x4b0c3c===null)throw G('Stored\x20Unit\x20is\x20unavailable');return{'error':void 0x0,'changesets':[..._0x4b0c3c]};}['getResourcesRequest'](_0x1698b3,_0x230dff){return Promise['resolve']({'error':void 0x0,'resources':{}});}async['saveSnapshot'](_0x30485b,_0x1d82d2){let _0x417c12=this['_requireCapture']();if(!_0x1d82d2['snapshot'])throw Error('SnapshotService\x20attempted\x20to\x20save\x20an\x20empty\x20snapshot');return _0x417c12['snapshot']=_0x1d82d2['snapshot'],{'error':on};}['updateSnapshot'](_0x48082b,_0x4a0bd4){return this['saveSnapshot'](_0x48082b,_0x4a0bd4);}async['saveSheetBlock'](_0x53afac,_0x1ef582){let _0x3e08f6=this['_requireCapture']();if(!_0x1ef582['block'])throw Error('SnapshotService\x20attempted\x20to\x20save\x20an\x20empty\x20Sheet\x20block');return _0x3e08f6['sheetBlocks']['push'](_0x1ef582['block']),{'error':on,'blockID':_0x1ef582['block']['id']};}['saveChangeset'](_0x1cf5c4,_0x5b3665){return W('saveChangeset');}['copyFileMeta'](_0x4028b6,_0x247b45){return W('copyFileMeta');}['getLatestCsReqIdBySid'](_0x3d4597,_0x4343b3){return W('getLatestCsReqIdBySid');}['_requireBinding'](_0x53650f){let _0x5d2755=this['_contexts']['get'](_0x53650f);if(!_0x5d2755)throw Error('Snapshot\x20operation\x20is\x20missing\x20its\x20Database\x20context');return _0x5d2755;}['_requireContext'](_0x2f64c3){return this['_requireBinding'](_0x2f64c3)['databaseContext'];}['_requireCapture'](){let _0x1a81b1=this['_capture']['getStore']();if(!_0x1a81b1)throw Error('Snapshot\x20save\x20was\x20called\x20outside\x20a\x20capture\x20operation');return _0x1a81b1;}async['_database'](_0x146eaa){try{return await _0x146eaa();}catch(_0x1f7580){throw _0x1f7580 instanceof S?_0x1f7580:new S('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x1f7580});}}};function W(_0xbd6316){return Promise['reject'](Error('SnapshotAdapterBridge\x20does\x20not\x20support\x20'+_0xbd6316));}function G(_0x519cee){return new S('ADAPTER_FAILURE',_0x519cee,{'retryable':!0x0});}function cn(_0x28b688){switch(_0x28b688['type']){case c['UniverType']['UNIVER_SHEET']:case c['UniverType']['UNIVER_BASE']:return _0x28b688['workbook']!==void 0x0;case c['UniverType']['UNIVER_DOC']:return _0x28b688['doc']!==void 0x0;case c['UniverType']['UNIVER_SLIDE']:return _0x28b688['slide']!==void 0x0;case c['UniverType']['UNIVER_BOARD']:return _0x28b688['board']!==void 0x0;default:return!0x1;}}function ln(_0x54bf62,_0x57422d,_0x2fab6d){let _0x934e7e=_0x57422d['rev']+0x1;for(let _0x2dcb78 of _0x2fab6d){if(_0x2dcb78['unitID']!==_0x54bf62['unitID']||_0x2dcb78['type']!==_0x54bf62['type']||_0x2dcb78['baseRev']!==_0x934e7e-0x1||_0x2dcb78['revision']!==_0x934e7e)throw G('Stored\x20changeset\x20history\x20is\x20not\x20contiguous');_0x934e7e+=0x1;}if(_0x934e7e-0x1!==_0x54bf62['revision'])throw G('Stored\x20changeset\x20history\x20is\x20incomplete');}function un(_0x3c04c3){_0x3c04c3['registerPlugin'](l['UniverCollaborationPlugin']),dn(_0x3c04c3),fn(_0x3c04c3),pn(_0x3c04c3),mn(_0x3c04c3),hn(_0x3c04c3),gn(_0x3c04c3);}function dn(_0x388ac8){_0x388ac8['registerPlugin'](v['UniverThreadCommentPlugin']),_0x388ac8['registerPlugin'](Ce['UniverThreadCommentResourcePlugin']),_0x388ac8['registerPlugin'](De['UniverDrawingPlugin']),_0x388ac8['registerPlugin'](he['UniverEmbedPlugin']);}function fn(_0xdfb601){_0xdfb601['registerPlugin'](Te['UniverDocsHyperLinkPlugin']),_0xdfb601['registerPlugin'](we['UniverDocsDrawingPlugin']),_0xdfb601['registerPlugin'](le['UniverDocsCalloutPlugin']),_0xdfb601['registerPlugin'](ue['UniverDocsChartPlugin']),_0xdfb601['registerPlugin'](de['UniverDocsCodePlugin']),_0xdfb601['registerPlugin'](fe['UniverDocsLatexPlugin']),_0xdfb601['registerPlugin'](pe['UniverDocsShapePlugin']),_0xdfb601['registerPlugin'](me['UniverDocsTablePlugin']),_0xdfb601['registerPlugin'](Ee['UniverDocsThreadCommentPlugin']);}function pn(_0x409647){_0x409647['registerPlugin'](h['UniverSheetsPlugin']),_0x409647['registerPlugin'](ge['UniverRustFormulaEnginePlugin'],{}),_0x409647['registerPlugin'](ke['UniverSheetsFormulaPlugin']),_0x409647['registerPlugin'](g['UniverSheetsConditionalFormattingPlugin']),_0x409647['registerPlugin'](_['UniverDataValidationPlugin']),_0x409647['registerPlugin'](te['UniverSheetsFilterPlugin']),_0x409647['registerPlugin'](Ae['UniverSheetsHyperLinkPlugin']),_0x409647['registerPlugin'](ye['UniverSheetsPivotTablePlugin']),_0x409647['registerPlugin'](Ne['UniverSheetsTablePlugin']),_0x409647['registerPlugin'](ve['UniverSheetsOutlinePlugin']),_0x409647['registerPlugin'](xe['UniverSheetSparklinePlugin']),_0x409647['registerPlugin'](Oe['UniverSheetsDrawingPlugin']),_0x409647['registerPlugin'](Me['UniverSheetsSortPlugin']),_0x409647['registerPlugin'](_e['UniverSheetsChartPlugin']),_0x409647['registerPlugin'](je['UniverSheetsNotePlugin']),_0x409647['registerPlugin'](be['UniverSheetsShapePlugin']),_0x409647['registerPlugin'](Pe['UniverSheetsThreadCommentPlugin']);}function mn(_0x16136d){_0x16136d['registerPlugin'](b['UniverSlidesPlugin']),_0x16136d['registerPlugin'](y['UniverSlidesChartPlugin']),_0x16136d['registerPlugin'](x['UniverSlidesTablePlugin']),_0x16136d['registerPlugin'](Se['UniverSlidesThreadCommentPlugin']);}function hn(_0x35f7b4){_0x35f7b4['registerPlugin'](ee['UniverBoardsPlugin']),_0x35f7b4['registerPlugin'](ae['UniverBoardsChartPlugin']),_0x35f7b4['registerPlugin'](se['UniverBoardsTablePlugin']),_0x35f7b4['registerPlugin'](oe['UniverBoardsMindPlugin']),_0x35f7b4['registerPlugin'](ce['UniverBoardsThreadCommentPlugin']);}function gn(_0x12c412){_0x12c412['registerPlugin'](p['UniverBasesPlugin']),_0x12c412['registerPlugin'](re['UniverBaseDashboardPlugin'],{'notExecuteCalculation':!0x0}),_0x12c412['registerPlugin'](ie['UniverBasesThreadCommentPlugin']);}var _n=0x32,vn=0x2bf20,yn=0x7530,bn=class{['unitID'];['type'];['_revision'];constructor(_0x2df78a,_0x4342db,_0x3db185){this['unitID']=_0x2df78a,this['type']=_0x4342db,this['_revision']=_0x3db185;}get['revision'](){return this['_revision'];}['advanceTo'](_0xbf0d58){this['_revision']=_0xbf0d58;}},K=class{['changesetTransformer'];['_reader'];['_maxLoadedUnits'];['_idleTimeoutMs'];['_univer'];['_instanceService'];['_commandService'];['_revisionService'];['_compressMutationService'];['_snapshotService'];['_snapshotSaveService'];['_formulaCalculationSessionService'];['_snapshotBridge'];['_entries']=new Map();['_ensuring']=new Map();['_disposed']=!0x1;constructor(_0x288aeb){if(this['_reader']=_0x288aeb['reader'],this['_maxLoadedUnits']=_0x288aeb['maxLoadedUnits']??_n,this['_idleTimeoutMs']=_0x288aeb['idleTimeoutMs']??vn,!Number['isSafeInteger'](this['_maxLoadedUnits'])||this['_maxLoadedUnits']<0x1)throw TypeError('maxLoadedUnits\x20must\x20be\x20a\x20positive\x20safe\x20integer');if(!Number['isSafeInteger'](this['_idleTimeoutMs'])||this['_idleTimeoutMs']<0x1)throw TypeError('idleTimeoutMs\x20must\x20be\x20a\x20positive\x20safe\x20integer');this['_univer']=new u['Univer']({'locale':u['LocaleType']['EN_US'],'locales':{[u['LocaleType']['EN_US']]:f['default']},'logLevel':u['LogLevel']['SILENT']}),this['_snapshotBridge']=new sn(this['_reader']);let _0x5cf0d5=this['_univer']['__getInjector']();_0x5cf0d5['add']([l['ISnapshotServerService'],{'useValue':this['_snapshotBridge']}]),_0x5cf0d5['add']([l['SnapshotSaveService']]),un(this['_univer']),this['_instanceService']=_0x5cf0d5['get'](u['IUniverInstanceService']),this['_commandService']=_0x5cf0d5['get'](u['ICommandService']),this['_revisionService']=_0x5cf0d5['get'](l['RevisionService']),this['_compressMutationService']=_0x5cf0d5['get'](l['CompressMutationService']),this['changesetTransformer']=new en(_0x5cf0d5['get'](l['ITransformService'])),this['_snapshotService']=_0x5cf0d5['get'](l['SnapshotService']),this['_snapshotSaveService']=_0x5cf0d5['get'](l['SnapshotSaveService']),this['_formulaCalculationSessionService']=_0x5cf0d5['get'](d['FormulaCalculationSessionService']);}['ensureUnit'](_0x492f9a,_0x2c367f,_0x150cb0){this['_assertOpen']();let _0x2c71e2=this['_ensuring']['get'](_0x2c367f);if(_0x2c71e2)return _0x2c71e2['then'](_0x36646b=>this['_retain'](_0x36646b));let _0x4912a1=this['_ensureUnit'](_0x492f9a,_0x2c367f,_0x150cb0)['finally'](()=>{this['_ensuring']['get'](_0x2c367f)===_0x4912a1&&this['_ensuring']['delete'](_0x2c367f);});return this['_ensuring']['set'](_0x2c367f,_0x4912a1),_0x4912a1['then'](_0x1a36d3=>this['_adoptReservation'](_0x1a36d3));}['releaseUnit'](_0x381d61){let _0x10816e=this['_entries']['get'](_0x381d61['unitID']);if(!(!_0x10816e||_0x10816e['handle']!==_0x381d61)){if(_0x10816e['busy']<0x1)throw Error('Unit\x20Runtime\x20lease\x20was\x20released\x20more\x20than\x20once');--_0x10816e['busy'],this['_touch'](_0x10816e),this['_evictOverCapacity']();}}async['applyChangeset'](_0x18ede2,_0x58745b,_0x4f9ca0,_0x26c802={}){this['_assertOpen']();let _0x258fae=this['_requireEntry'](_0x58745b);return this['_withBusy'](_0x258fae,async()=>{try{return await this['_applyConfirmedChangeset'](_0x18ede2,_0x258fae['handle'],_0x4f9ca0,_0x26c802);}catch(_0x57bb9b){throw this['disposeUnit'](_0x58745b['unitID']),_0x57bb9b instanceof S?_0x57bb9b:new S('INTERNAL_ERROR','Failed\x20to\x20apply\x20changeset\x20to\x20Unit\x20Runtime',{'retryable':!0x0,'cause':_0x57bb9b});}});}async['createSnapshot'](_0x1576c3){this['_assertOpen']();let _0x4fd1ac=this['_requireEntry'](_0x1576c3);return this['_withBusy'](_0x4fd1ac,async()=>{try{let _0x33450f=await this['_snapshotBridge']['capture'](()=>this['_createProtocolSnapshot'](_0x4fd1ac['handle'])),_0x11a5ee=_0x33450f['result']['snapshot']??_0x33450f['snapshot'];if(!_0x11a5ee)throw Error('SDK\x20snapshot\x20generation\x20returned\x20no\x20snapshot');return{'snapshot':_0x11a5ee,..._0x33450f['sheetBlocks']['length']>0x0?{'sheetBlocks':_0x33450f['sheetBlocks']}:{}};}catch(_0x2fe0c9){throw this['disposeUnit'](_0x1576c3['unitID']),new S('INTERNAL_ERROR','Failed\x20to\x20create\x20Unit\x20Runtime\x20snapshot',{'retryable':!0x0,'cause':_0x2fe0c9});}});}['disposeUnit'](_0x1aa37f){let _0x5f3eb5=this['_entries']['get'](_0x1aa37f);_0x5f3eb5?.['idleTimer']&&clearTimeout(_0x5f3eb5['idleTimer']),this['_entries']['delete'](_0x1aa37f),this['_instanceService']['disposeUnit'](_0x1aa37f);}async['dispose'](){if(!this['_disposed']){this['_disposed']=!0x0;for(let _0x1abbf0 of[...this['_entries']['keys']()])this['disposeUnit'](_0x1abbf0);this['_ensuring']['clear'](),this['_univer']['dispose']();}}async['_ensureUnit'](_0x1937cd,_0x3a8328,_0x4df34c){xn(_0x3a8328,_0x4df34c);let _0x62267a=await this['_database'](()=>this['_reader']['getUnit'](_0x1937cd,_0x3a8328));if(!_0x62267a)throw new S('UNIT_NOT_FOUND','Unit\x20'+_0x3a8328+'\x20does\x20not\x20exist');if(_0x62267a['unitID']!==_0x3a8328)throw new S('ADAPTER_FAILURE','Stored\x20Unit\x20metadata\x20belongs\x20to\x20a\x20different\x20identity',{'retryable':!0x0});if(_0x62267a['type']!==_0x4df34c)throw new S('INVALID_REQUEST','Unit\x20type\x20does\x20not\x20match\x20the\x20stored\x20Unit');if(!Number['isSafeInteger'](_0x62267a['headRevision'])||_0x62267a['headRevision']<0x1)throw new S('ADAPTER_FAILURE','Stored\x20Unit\x20metadata\x20is\x20invalid',{'retryable':!0x0});let _0x392be4=this['_entries']['get'](_0x3a8328);if(_0x392be4&&_0x392be4['handle']['type']!==_0x4df34c&&(this['disposeUnit'](_0x3a8328),_0x392be4=void 0x0),_0x392be4&&_0x392be4['handle']['revision']>_0x62267a['headRevision']&&(this['disposeUnit'](_0x3a8328),_0x392be4=void 0x0),_0x392be4)try{return await this['_withBusy'](_0x392be4,async()=>{_0x392be4['handle']['revision']<_0x62267a['headRevision']&&await this['_replayRange'](_0x1937cd,_0x392be4['handle'],_0x392be4['handle']['revision'],_0x62267a['headRevision']);},!0x1),_0x392be4['busy']+=0x1,_0x392be4['handle'];}catch{this['disposeUnit'](_0x3a8328);}return this['_loadUnit'](_0x1937cd,_0x3a8328,_0x4df34c,_0x62267a['headRevision']);}async['_loadUnit'](_0x2ac663,_0x6f777b,_0x24fa67,_0xba8b35){let _0xe4a0ab=await this['_database'](()=>this['_reader']['getSnapshot'](_0x2ac663,_0x6f777b,{'revision':_0xba8b35}));if(!_0xe4a0ab||_0xe4a0ab['unitID']!==_0x6f777b||_0xe4a0ab['type']!==_0x24fa67||!Number['isSafeInteger'](_0xe4a0ab['rev'])||_0xe4a0ab['rev']<0x1||_0xe4a0ab['rev']>_0xba8b35)throw new S('ADAPTER_FAILURE','Stored\x20Unit\x20snapshot\x20is\x20invalid',{'retryable':!0x0});try{if(await this['_loadSdkUnit'](_0x2ac663,_0x6f777b,_0x24fa67,_0xe4a0ab['rev'],_0xe4a0ab),this['_revisionService']['getCurrentRevOfUnit'](_0x6f777b)!==_0xe4a0ab['rev'])throw Error('SDK\x20loaded\x20Unit\x20at\x20an\x20unexpected\x20revision');let _0x45284d=new bn(_0x6f777b,_0x24fa67,_0xe4a0ab['rev']),_0x232d2a={'handle':_0x45284d,'busy':0x1};if(this['_entries']['set'](_0x6f777b,_0x232d2a),_0xe4a0ab['rev']<_0xba8b35&&await this['_replayRange'](_0x2ac663,_0x45284d,_0xe4a0ab['rev'],_0xba8b35),_0x45284d['revision']!==_0xba8b35)throw Error('Runtime\x20did\x20not\x20reach\x20the\x20requested\x20revision');return _0x45284d;}catch(_0x5b42f9){throw this['disposeUnit'](_0x6f777b),_0x5b42f9 instanceof S?_0x5b42f9:new S('INTERNAL_ERROR','Failed\x20to\x20load\x20Unit\x20Runtime',{'retryable':!0x0,'cause':_0x5b42f9});}}async['_loadSdkUnit'](_0x14d7a1,_0x1390c5,_0x3fd50b,_0x26760e,_0x26705d){let _0x127098=this['_snapshotBridge']['createContext'](_0x14d7a1,_0x26705d);switch(_0x3fd50b){case c['UniverType']['UNIVER_SHEET']:await this['_snapshotService']['loadSheet'](_0x1390c5,_0x26760e,_0x127098);return;case c['UniverType']['UNIVER_DOC']:await this['_snapshotService']['loadDoc'](_0x1390c5,_0x26760e,_0x127098),nn(this['_commandService']);return;case c['UniverType']['UNIVER_SLIDE']:await this['_snapshotService']['loadSlide'](_0x1390c5,_0x26760e,_0x127098);return;case c['UniverType']['UNIVER_BOARD']:await this['_snapshotService']['loadBoard'](_0x1390c5,_0x26760e,_0x127098);return;case c['UniverType']['UNIVER_BASE']:await this['_snapshotService']['loadBase'](_0x1390c5,_0x26760e,_0x127098);return;}throw Error('Unsupported\x20Unit\x20type:\x20'+_0x3fd50b);}async['_createProtocolSnapshot'](_0x6b33ca){let _0x1f40a7={};switch(_0x6b33ca['type']){case c['UniverType']['UNIVER_SHEET']:{await this['_formulaCalculationSessionService']['waitForLatestApplied'](yn);let _0x327906=this['_requireSdkUnit'](_0x6b33ca,u['UniverInstanceType']['UNIVER_SHEET']),_0x13b9d=await this['_snapshotSaveService']['getSheet'](_0x1f40a7,_0x6b33ca['unitID'],_0x6b33ca['revision'],_0x327906);if(!_0x13b9d['snapshot']['workbook'])throw Error('SDK\x20Sheet\x20snapshot\x20has\x20no\x20workbook\x20payload');return{..._0x13b9d,'snapshot':{..._0x13b9d['snapshot'],'workbook':{..._0x13b9d['snapshot']['workbook'],'sheetOrder':_0x327906['getSheets']()['map'](_0x2f3bcf=>_0x2f3bcf['getSheetId']())}}};}case c['UniverType']['UNIVER_DOC']:{let _0x12cdbd=this['_requireSdkUnit'](_0x6b33ca,u['UniverInstanceType']['UNIVER_DOC']);return this['_snapshotSaveService']['getDoc'](_0x1f40a7,_0x6b33ca['unitID'],_0x6b33ca['revision'],_0x12cdbd);}case c['UniverType']['UNIVER_SLIDE']:{let _0x34ae7c=this['_requireSdkUnit'](_0x6b33ca,u['UniverInstanceType']['UNIVER_SLIDE']);return this['_snapshotService']['saveSlide'](_0x6b33ca['unitID'],_0x34ae7c['getSnapshot'](),_0x6b33ca['revision']);}case c['UniverType']['UNIVER_BOARD']:{let _0xb55b50=this['_requireSdkUnit'](_0x6b33ca,u['UniverInstanceType']['UNIVER_BOARD']);return this['_snapshotService']['saveBoard'](_0x6b33ca['unitID'],_0xb55b50['getSnapshot'](),_0x6b33ca['revision']);}case c['UniverType']['UNIVER_BASE']:{let _0x29c78a=this['_requireSdkUnit'](_0x6b33ca,u['UniverInstanceType']['UNIVER_BASE']);return this['_snapshotSaveService']['getBase'](_0x1f40a7,_0x6b33ca['unitID'],_0x6b33ca['revision'],_0x29c78a);}}throw Error('Unsupported\x20Unit\x20type:\x20'+_0x6b33ca['type']);}['_requireSdkUnit'](_0x512cfd,_0x207de0){let _0x166f0b=this['_instanceService']['getUnit'](_0x512cfd['unitID'],_0x207de0);if(!_0x166f0b||this['_revisionService']['getCurrentRevOfUnit'](_0x512cfd['unitID'])!==_0x512cfd['revision'])throw Error('Runtime\x20Unit\x20or\x20revision\x20is\x20unavailable');return _0x166f0b;}async['_replayRange'](_0xc85924,_0x1adc2b,_0x233635,_0x3809aa){let _0x2153f2=await this['_database'](()=>this['_reader']['getChangesets'](_0xc85924,_0x1adc2b['unitID'],{'from':_0x233635,'to':_0x3809aa}));if(_0x2153f2===null)throw new S('ADAPTER_FAILURE','Unit\x20is\x20unavailable\x20during\x20replay',{'retryable':!0x0});let _0x5b6788=_0x233635+0x1;for(let _0x4164b1 of _0x2153f2){if(_0x4164b1['unitID']!==_0x1adc2b['unitID']||_0x4164b1['type']!==_0x1adc2b['type']||_0x4164b1['baseRev']!==_0x5b6788-0x1||_0x4164b1['revision']!==_0x5b6788)throw new S('ADAPTER_FAILURE','Stored\x20changeset\x20history\x20is\x20not\x20contiguous',{'retryable':!0x0});await this['_applyConfirmedChangeset'](_0xc85924,_0x1adc2b,_0x4164b1),_0x5b6788+=0x1;}if(_0x5b6788-0x1!==_0x3809aa)throw new S('ADAPTER_FAILURE','Stored\x20changeset\x20history\x20is\x20incomplete',{'retryable':!0x0});}async['_applyConfirmedChangeset'](_0x22bab9,_0x261822,_0x282ab7,_0x203f48={}){if(_0x282ab7['unitID']!==_0x261822['unitID']||_0x282ab7['type']!==_0x261822['type']||_0x282ab7['baseRev']!==_0x261822['revision']||_0x282ab7['revision']!==_0x261822['revision']+0x1)throw Error('Changeset\x20does\x20not\x20follow\x20the\x20Runtime\x20revision');let _0x1e7505=(0x0,l['parseProtocolChangeset'])(_0x282ab7),_0xc4d76a=_0x1e7505['mutations']['find'](_0x355eff=>_0x355eff['id']===l['RevertRevisionMutation']['id']);if(_0xc4d76a){if(_0x1e7505['mutations']['length']!==0x1)throw new S('INVALID_REQUEST','A\x20restore\x20changeset\x20cannot\x20contain\x20other\x20mutations');let _0x20086b=_0xc4d76a['params'];if(_0x20086b['unitId']!==_0x261822['unitID']||!Number['isSafeInteger'](_0x20086b['revision'])||_0x20086b['revision']<0x1||_0x20086b['revision']>_0x282ab7['baseRev'])throw new S('INVALID_REQUEST','Restore\x20target\x20must\x20identify\x20an\x20existing\x20revision\x20of\x20this\x20Unit');let _0x4c35d2={'requiredUnitPermissions':[]};if(_0x203f48['collectUnitPermissions']){let _0x7373f3=new $t(this['_univer'],_0x261822),_0x9916ae=performance['now']();_0x7373f3['collect'](_0xc4d76a);let _0x214590=performance['now']()-_0x9916ae;_0x4c35d2={'requiredUnitPermissions':_0x7373f3['finish'](),'permissionAnalysisDurationMs':_0x214590};}return await this['_restoreHistoricalRevision'](_0x22bab9,_0x261822,_0x282ab7,_0x20086b['revision']),_0x4c35d2;}let _0x2f8821=this['_compressMutationService']['interceptor']['fetchThroughInterceptors'](this['_compressMutationService']['interceptor']['getInterceptPoints']()['COMPRESS_MUTATION_APPLY'])(_0x1e7505['mutations'],null)??_0x1e7505['mutations'],_0x18d6ba=this['_applyMutations'](_0x261822,_0x282ab7,_0x2f8821,_0x203f48['collectUnitPermissions']===!0x0),_0x50a4b4=this['_revisionService']['incrementRevOfUnit'](_0x261822['unitID']);if(_0x50a4b4!==_0x282ab7['revision'])throw Error('Univer\x20Runtime\x20revision\x20did\x20not\x20advance\x20as\x20expected');return _0x261822['advanceTo'](_0x50a4b4),_0x18d6ba;}['_applyMutations'](_0x15ce07,_0x525a3c,_0xd1e4a2,_0x273f35){if(!_0x273f35)return this['_executeMutationBatch'](_0x525a3c,_0xd1e4a2),{'requiredUnitPermissions':[]};let _0x1fe559=new $t(this['_univer'],_0x15ce07),_0x594fa9=0x0;for(let [_0x52d89b,_0x5746a9]of _0xd1e4a2['entries']()){let _0xa14b23=performance['now']();_0x1fe559['collect'](_0x5746a9),_0x594fa9+=performance['now']()-_0xa14b23,this['_executeMutationBatch'](_0x525a3c,[_0x5746a9],_0x52d89b);}return{'requiredUnitPermissions':_0x1fe559['finish'](),'permissionAnalysisDurationMs':_0x594fa9};}['_executeMutationBatch'](_0x151ae0,_0x5b8b53,_0x1636ef=0x0){let _0x2190c2=(0x0,u['sequenceExecute'])(_0x5b8b53,this['_commandService'],{'fromChangeset':!0x0});if(_0x2190c2['result'])return;let _0x304a8c=_0x5b8b53[_0x2190c2['index']],_0x47ad94=_0x1636ef+_0x2190c2['index'];throw new S('INTERNAL_ERROR','Unit\x20Runtime\x20failed\x20to\x20execute\x20mutation\x20\x22'+_0x304a8c['id']+'\x22\x20for\x20Unit\x20\x22'+_0x151ae0['unitID']+'\x22\x20at\x20revision\x20'+_0x151ae0['revision']+'\x20(index\x20'+_0x47ad94+')',{'retryable':!0x0,'cause':_0x2190c2['error']});}async['_restoreHistoricalRevision'](_0x46da3d,_0x20456f,_0x168ab0,_0x4ff46f){let _0x96bf71=await this['_database'](()=>this['_reader']['getSnapshot'](_0x46da3d,_0x20456f['unitID'],{'revision':_0x4ff46f}));if(!_0x96bf71||_0x96bf71['unitID']!==_0x20456f['unitID']||_0x96bf71['type']!==_0x20456f['type']||!Number['isSafeInteger'](_0x96bf71['rev'])||_0x96bf71['rev']<0x1||_0x96bf71['rev']>_0x4ff46f)throw new S('ADAPTER_FAILURE','Stored\x20restore\x20snapshot\x20is\x20invalid',{'retryable':!0x0});this['_instanceService']['disposeUnit'](_0x20456f['unitID']),await this['_loadSdkUnit'](_0x46da3d,_0x20456f['unitID'],_0x20456f['type'],_0x96bf71['rev'],_0x96bf71);let _0x230009=new bn(_0x20456f['unitID'],_0x20456f['type'],_0x96bf71['rev']);if(_0x230009['revision']<_0x4ff46f&&await this['_replayRange'](_0x46da3d,_0x230009,_0x230009['revision'],_0x4ff46f),_0x230009['revision']!==_0x4ff46f)throw new S('ADAPTER_FAILURE','Restore\x20history\x20did\x20not\x20reach\x20its\x20target\x20revision',{'retryable':!0x0});if(this['_revisionService']['setRevOfUnit'](_0x20456f['unitID'],_0x168ab0['revision']),this['_revisionService']['getCurrentRevOfUnit'](_0x20456f['unitID'])!==_0x168ab0['revision'])throw Error('Univer\x20Runtime\x20did\x20not\x20adopt\x20the\x20restored\x20revision');_0x20456f['advanceTo'](_0x168ab0['revision']);}['_requireEntry'](_0x6ad79){let _0x14fab1=this['_entries']['get'](_0x6ad79['unitID']);if(!_0x14fab1||_0x14fab1['handle']!==_0x6ad79||_0x14fab1['handle']['type']!==_0x6ad79['type'])throw new S('INTERNAL_ERROR','Unit\x20Runtime\x20handle\x20is\x20stale',{'retryable':!0x0});return _0x14fab1;}async['_withBusy'](_0x1c8e68,_0x16ef30,_0x5a3de1=!0x0){_0x1c8e68['busy']+=0x1,_0x1c8e68['idleTimer']&&(clearTimeout(_0x1c8e68['idleTimer']),delete _0x1c8e68['idleTimer']);try{return await _0x16ef30();}finally{--_0x1c8e68['busy'],_0x5a3de1&&this['_entries']['get'](_0x1c8e68['handle']['unitID'])===_0x1c8e68&&(this['_touch'](_0x1c8e68),this['_evictOverCapacity']());}}['_retain'](_0x7b29ff){let _0x552a6f=this['_entries']['get'](_0x7b29ff['unitID']);if(!_0x552a6f||_0x552a6f['handle']!==_0x7b29ff)throw new S('INTERNAL_ERROR','Unit\x20Runtime\x20was\x20disposed\x20before\x20its\x20lease\x20could\x20be\x20acquired',{'retryable':!0x0});return _0x552a6f['busy']+=0x1,this['_touch'](_0x552a6f),this['_evictOverCapacity'](),_0x7b29ff;}['_adoptReservation'](_0x390511){let _0xd63662=this['_entries']['get'](_0x390511['unitID']);if(!_0xd63662||_0xd63662['handle']!==_0x390511||_0xd63662['busy']<0x1)throw new S('INTERNAL_ERROR','Unit\x20Runtime\x20load\x20reservation\x20is\x20unavailable',{'retryable':!0x0});return this['_touch'](_0xd63662),this['_evictOverCapacity'](),_0x390511;}['_touch'](_0x4376b1){let {unitID:_0xfb155d}=_0x4376b1['handle'];if(_0x4376b1['idleTimer']&&clearTimeout(_0x4376b1['idleTimer']),this['_entries']['delete'](_0xfb155d),this['_entries']['set'](_0xfb155d,_0x4376b1),_0x4376b1['busy']>0x0){delete _0x4376b1['idleTimer'];return;}_0x4376b1['idleTimer']=setTimeout(()=>{_0x4376b1['busy']===0x0&&this['_entries']['get'](_0xfb155d)===_0x4376b1&&this['disposeUnit'](_0xfb155d);},this['_idleTimeoutMs']),_0x4376b1['idleTimer']['unref']?.();}['_evictOverCapacity'](){for(;this['_entries']['size']>this['_maxLoadedUnits'];){let _0xed7762=[...this['_entries']['values']()]['find'](_0x31e398=>_0x31e398['busy']===0x0);if(!_0xed7762)return;this['disposeUnit'](_0xed7762['handle']['unitID']);}}async['_database'](_0x1499ee){try{return await _0x1499ee();}catch(_0x1a88ee){throw _0x1a88ee instanceof S?_0x1a88ee:new S('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x1a88ee});}}['_assertOpen'](){if(this['_disposed'])throw new S('INTERNAL_ERROR','Unit\x20Runtime\x20is\x20disposed',{'retryable':!0x0});}};function xn(_0x4c78e8,_0x5f4780){if(!_0x4c78e8)throw new S('INVALID_REQUEST','unitID\x20is\x20required');if(!Sn['has'](_0x5f4780))throw new S('INVALID_REQUEST','Unsupported\x20Unit\x20type:\x20'+_0x5f4780);}var Sn=new Set([c['UniverType']['UNIVER_SHEET'],c['UniverType']['UNIVER_DOC'],c['UniverType']['UNIVER_SLIDE'],c['UniverType']['UNIVER_BOARD'],c['UniverType']['UNIVER_BASE']]),Cn=class{['_options'];constructor(_0x49e71e){this['_options']=_0x49e71e;}async['submit'](_0x4a7bee,_0x2f20f9){let _0x39f40d=_0x2f20f9['changeset'];wn(_0x39f40d);let _0xf85375={..._0x4a7bee,'request':_0x2f20f9};try{return await this['_options']['coordinator']['runExclusive'](_0x39f40d['unitID'],async()=>{let _0xeb8b96=this['_options']['maxRevisionRetries']+0x1;for(let _0x4f08fc=0x1;_0x4f08fc<=_0xeb8b96;_0x4f08fc+=0x1){let _0x4b2dd3=await this['_attempt'](_0xf85375,_0x4a7bee,_0x2f20f9,_0x39f40d,_0x4f08fc);if(_0x4b2dd3['status']!=='retry-attempt')return _0x4b2dd3;}throw this['_options']['runtime']['disposeUnit'](_0x39f40d['unitID']),new S('REVISION_MISMATCH','Changeset\x20could\x20not\x20be\x20committed\x20after\x20bounded\x20retries',{'retryable':!0x0});});}catch(_0x38f660){throw _0x38f660 instanceof S&&_0x38f660['code']==='UNIT_NOT_FOUND'&&this['_options']['runtime']['disposeUnit'](_0x39f40d['unitID']),_0x38f660;}}async['_attempt'](_0x55448b,_0x363475,_0x1accf4,_0x301583,_0x321102){let _0x3fa541=await this['_measure']('load',()=>this['_options']['runtime']['ensureUnit'](_0x55448b,_0x301583['unitID'],_0x301583['type']));try{let _0x554761=_0x3fa541['revision'];if(_0x301583['baseRev']>_0x554761)throw new S('REVISION_MISMATCH','Changeset\x20base\x20revision\x20is\x20ahead\x20of\x20the\x20Unit\x20head');let _0x3ef4a3=await this['_getHistory'](_0x55448b,_0x301583['unitID'],_0x301583['type'],_0x301583['baseRev'],_0x554761),_0x44489=En(_0x3ef4a3,_0x301583);if(_0x44489)return q(_0x44489,_0x301583),J(_0x44489)&&await this['_ensureRestoreSnapshot'](_0x55448b,_0x3fa541,_0x44489)?(await this['_options']['onCommitted'](_0x363475,_0x1accf4,_0x44489,[]),{'status':'committed','changeset':_0x44489}):{'status':'already-committed','changeset':_0x44489};let _0x1d5036=await this['_measure']('transform',async()=>this['_createCandidate'](_0x301583,_0x3ef4a3,_0x554761)),_0x5448d5=[],_0x503f0c=!0x1;try{let _0x2a8f90={'userID':_0x363475['userID'],'memberID':_0x363475['memberID'],'customData':_0x363475['customData'],'request':_0x1accf4,'attempt':_0x321102,'currentRevision':_0x554761,'changeset':_0x1d5036};await this['_measure']('applyMiddleware',()=>this['_options']['middleware']['run']('applyChangeset',_0x2a8f90,async()=>{let _0x66f990=await this['_measure']('executeMutations',()=>this['_options']['runtime']['applyChangeset'](_0x55448b,_0x3fa541,_0x1d5036,{'collectUnitPermissions':this['_options']['enableUnitPermissionAnalysis']===!0x0}));_0x5448d5=_0x66f990['requiredUnitPermissions'];let _0x3fff8a=_0x66f990['permissionAnalysisDurationMs'];_0x3fff8a!==void 0x0&&this['_options']['metrics']['observe']('collaboration.submit.duration',_0x3fff8a,{'stage':'unitPermissionAnalysis'}),_0x503f0c=!0x0;}));let _0x1c27c6=await this['_runCommitMiddleware'](_0x55448b,_0x363475,_0x1accf4,_0x1d5036,_0x321102,_0x554761,_0x5448d5);if(!_0x1c27c6)return this['_options']['runtime']['disposeUnit'](_0x301583['unitID']),{'status':'retry-attempt'};switch(_0x1c27c6['status']){case'revision-mismatch':if(!Number['isSafeInteger'](_0x1c27c6['actualHeadRevision'])||_0x1c27c6['actualHeadRevision']<0x1)throw X('Database\x20returned\x20an\x20invalid\x20head\x20revision\x20mismatch');return this['_options']['runtime']['disposeUnit'](_0x301583['unitID']),this['_options']['metrics']['increment']('collaboration.submit.retry',{'reason':'revision-mismatch'}),{'status':'retry-attempt'};case'recovered-committed':return J(_0x1c27c6['changeset'])?(await this['_ensureRestoreSnapshot'](_0x55448b,_0x3fa541,_0x1c27c6['changeset']),await this['_options']['onCommitted'](_0x363475,_0x1accf4,_0x1c27c6['changeset'],_0x5448d5),{'status':'committed','changeset':_0x1c27c6['changeset']}):(this['_options']['runtime']['disposeUnit'](_0x301583['unitID']),await this['_options']['onCommitted'](_0x363475,_0x1accf4,_0x1c27c6['changeset'],_0x5448d5),await this['_snapshotBestEffort'](_0x55448b,void 0x0,_0x1c27c6['changeset']),{'status':'committed','changeset':_0x1c27c6['changeset']});case'committed':return q(_0x1c27c6['changeset'],_0x1d5036,!0x0),J(_0x1c27c6['changeset'])?(await this['_ensureRestoreSnapshot'](_0x55448b,_0x3fa541,_0x1c27c6['changeset']),await this['_options']['onCommitted'](_0x363475,_0x1accf4,_0x1c27c6['changeset'],_0x5448d5),{'status':'committed','changeset':_0x1c27c6['changeset']}):(await this['_options']['onCommitted'](_0x363475,_0x1accf4,_0x1c27c6['changeset'],_0x5448d5),await this['_snapshotBestEffort'](_0x55448b,_0x3fa541,_0x1c27c6['changeset']),{'status':'committed','changeset':_0x1c27c6['changeset']});}}catch(_0x37b2bf){throw _0x503f0c&&this['_options']['runtime']['disposeUnit'](_0x301583['unitID']),_0x37b2bf;}}finally{this['_options']['runtime']['releaseUnit'](_0x3fa541);}}async['_runCommitMiddleware'](_0x49ec93,_0x1d349b,_0x46ed41,_0x24c18e,_0x4085bb,_0x251497,_0x3a0d55){let _0x4ab701,_0x559b36,_0x459ba3={'userID':_0x1d349b['userID'],'memberID':_0x1d349b['memberID'],'customData':_0x1d349b['customData'],'request':_0x46ed41,'attempt':_0x4085bb,'expectedHeadRevision':_0x251497,'changeset':_0x24c18e,'requiredUnitPermissions':_0x3a0d55};try{await this['_measure']('commitMiddleware',()=>this['_options']['middleware']['run']('commitChangeset',_0x459ba3,async()=>{try{_0x4ab701=await this['_measure']('databaseCommit',()=>this['_database'](()=>this['_options']['dbAdapter']['commitChangeset'](_0x49ec93,{'changeset':_0x24c18e})));}catch(_0x9700ab){throw _0x559b36=_0x9700ab,_0x9700ab;}}));}catch(_0xdde625){if(_0x4ab701)return this['_options']['logger']['error']('commitChangeset\x20middleware\x20failed\x20after\x20database\x20commit',{'error':On(_0xdde625)}),_0x4ab701;if(!_0x559b36)throw _0xdde625;if(_0x559b36 instanceof S&&!_0x559b36['retryable'])throw _0x559b36;}if(_0x4ab701)return _0x4ab701;let _0x2ea4c7=En(await this['_getHistoryToLatest'](_0x49ec93,_0x24c18e['unitID'],_0x24c18e['type'],_0x251497),_0x24c18e);return _0x2ea4c7?(q(_0x2ea4c7,_0x24c18e),{'status':'recovered-committed','changeset':_0x2ea4c7}):(this['_options']['metrics']['increment']('collaboration.submit.retry',{'reason':'unknown-commit'}),null);}async['_getHistory'](_0xd59b57,_0x658a68,_0x514ea3,_0x1dea54,_0x41f0e7){if(_0x1dea54===_0x41f0e7)return[];let _0x153c0e=await this['_database'](()=>this['_options']['dbAdapter']['getChangesets'](_0xd59b57,_0x658a68,{'from':_0x1dea54,'to':_0x41f0e7}));if(_0x153c0e===null)throw X('Unit\x20is\x20unavailable\x20while\x20reading\x20changeset\x20history');let _0x246a26=_0x1dea54+0x1;for(let _0x8f5cd0 of _0x153c0e){if(_0x8f5cd0['unitID']!==_0x658a68||_0x8f5cd0['type']!==_0x514ea3||_0x8f5cd0['baseRev']!==_0x246a26-0x1||_0x8f5cd0['revision']!==_0x246a26)throw X('Stored\x20changeset\x20history\x20is\x20not\x20contiguous');_0x246a26+=0x1;}if(_0x246a26-0x1!==_0x41f0e7)throw X('Stored\x20changeset\x20history\x20is\x20incomplete');return _0x153c0e;}async['_getHistoryToLatest'](_0x2189f8,_0x4dee21,_0x39d2e9,_0x59b8b5){let _0x34f5b7=await this['_database'](()=>this['_options']['dbAdapter']['getChangesets'](_0x2189f8,_0x4dee21,{'from':_0x59b8b5}));if(_0x34f5b7===null)throw X('Unit\x20is\x20unavailable\x20while\x20reading\x20changeset\x20history');let _0x48cd5f=_0x59b8b5+0x1;for(let _0x4f005d of _0x34f5b7){if(_0x4f005d['unitID']!==_0x4dee21||_0x4f005d['type']!==_0x39d2e9||_0x4f005d['baseRev']!==_0x48cd5f-0x1||_0x4f005d['revision']!==_0x48cd5f)throw X('Stored\x20changeset\x20history\x20is\x20not\x20contiguous');_0x48cd5f+=0x1;}return _0x34f5b7;}['_createCandidate'](_0xe8be2a,_0x17a732,_0x44e2c0){let _0xb4cc19=this['_options']['transformer']['parseClient'](_0xe8be2a);return{...this['_options']['transformer']['transform'](_0xb4cc19,_0x17a732),'unitID':_0xe8be2a['unitID'],'type':_0xe8be2a['type'],'baseRev':_0x44e2c0,'revision':_0x44e2c0+0x1,'sid':_0xe8be2a['sid'],'reqId':_0xe8be2a['reqId']};}async['_snapshotBestEffort'](_0x2c141b,_0x5cacab,_0x492f06){let _0x34e51f=this['_options']['snapshotPolicy'];if(!_0x34e51f)return;let _0x390b7c;try{await this['_measure']('snapshot',async()=>{let _0x1fc1a6=await this['_database'](()=>this['_options']['dbAdapter']['getSnapshotInfo'](_0x2c141b,_0x492f06['unitID']));if(!_0x1fc1a6||_0x1fc1a6['unitID']!==_0x492f06['unitID']||_0x1fc1a6['type']!==_0x492f06['type']||!Number['isSafeInteger'](_0x1fc1a6['rev'])||_0x1fc1a6['rev']<0x1)throw X('Database\x20returned\x20invalid\x20latest\x20snapshot\x20info');if(_0x1fc1a6['rev']>=_0x492f06['revision'])return;let _0x511171=_0x492f06['revision']-_0x1fc1a6['rev'];if(!J(_0x492f06)&&!_0x34e51f['shouldCreate']({'unitID':_0x492f06['unitID'],'type':_0x492f06['type'],'revision':_0x492f06['revision'],'changesetBytes':Dn(_0x492f06),'revisionsSinceLastSnapshot':_0x511171}))return;let _0x32db53=_0x5cacab??(_0x390b7c=await this['_options']['runtime']['ensureUnit'](_0x2c141b,_0x492f06['unitID'],_0x492f06['type'])),_0x2bbc9f=await this['_options']['runtime']['createSnapshot'](_0x32db53);await this['_database'](()=>this['_options']['dbAdapter']['saveSnapshot'](_0x2c141b,_0x2bbc9f));});}catch(_0x24a2e1){_0x24a2e1 instanceof S&&_0x24a2e1['code']==='UNIT_NOT_FOUND'&&this['_options']['runtime']['disposeUnit'](_0x492f06['unitID']),this['_options']['metrics']['increment']('collaboration.snapshot.failure'),this['_options']['logger']['warn']('Best-effort\x20snapshot\x20failed',{'unitID':_0x492f06['unitID'],'revision':_0x492f06['revision'],'error':On(_0x24a2e1)});}finally{_0x390b7c&&this['_options']['runtime']['releaseUnit'](_0x390b7c);}}async['_ensureRestoreSnapshot'](_0x372370,_0x464d25,_0xb74656){let _0x289701;try{return await this['_measure']('restoreSnapshot',async()=>{if((await this['_getValidatedSnapshot'](_0x372370,_0xb74656))['rev']===_0xb74656['revision'])return!0x1;let _0x36fbe0=_0x464d25??(_0x289701=await this['_options']['runtime']['ensureUnit'](_0x372370,_0xb74656['unitID'],_0xb74656['type']));if(_0x36fbe0['revision']!==_0xb74656['revision'])throw X('Unit\x20Runtime\x20is\x20not\x20at\x20the\x20committed\x20restore\x20revision');let _0x15373b=await this['_options']['runtime']['createSnapshot'](_0x36fbe0);if(_0x15373b['snapshot']['unitID']!==_0xb74656['unitID']||_0x15373b['snapshot']['type']!==_0xb74656['type']||_0x15373b['snapshot']['rev']!==_0xb74656['revision'])throw X('Unit\x20Runtime\x20returned\x20an\x20invalid\x20restore\x20snapshot');try{await this['_database'](()=>this['_options']['dbAdapter']['saveSnapshot'](_0x372370,_0x15373b));}catch(_0x2e1d36){if((await this['_getValidatedSnapshot'](_0x372370,_0xb74656))['rev']!==_0xb74656['revision'])throw _0x2e1d36;}return!0x0;});}catch(_0x36b444){throw this['_options']['metrics']['increment']('collaboration.snapshot.failure',{'reason':'restore-required'}),this['_options']['logger']['warn']('Required\x20restore\x20snapshot\x20failed',{'unitID':_0xb74656['unitID'],'revision':_0xb74656['revision'],'error':On(_0x36b444)}),_0x36b444;}finally{_0x289701&&this['_options']['runtime']['releaseUnit'](_0x289701);}}async['_getValidatedSnapshot'](_0x5f1c43,_0x2690c7){let _0x39fac8=await this['_database'](()=>this['_options']['dbAdapter']['getSnapshot'](_0x5f1c43,_0x2690c7['unitID'],{'revision':_0x2690c7['revision']}));if(!_0x39fac8||_0x39fac8['unitID']!==_0x2690c7['unitID']||_0x39fac8['type']!==_0x2690c7['type']||!Number['isSafeInteger'](_0x39fac8['rev'])||_0x39fac8['rev']<0x1||_0x39fac8['rev']>_0x2690c7['revision'])throw X('Database\x20returned\x20an\x20invalid\x20nearest\x20snapshot');return _0x39fac8;}async['_database'](_0x5e5b0e){try{return await _0x5e5b0e();}catch(_0x4b502a){throw _0x4b502a instanceof S?_0x4b502a:new S('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x4b502a});}}async['_measure'](_0x1440aa,_0x85083d){let _0x29f763=performance['now']();try{return await _0x85083d();}finally{this['_options']['metrics']['observe']('collaboration.submit.duration',performance['now']()-_0x29f763,{'stage':_0x1440aa});}}};function wn(_0x5934aa){if(!_0x5934aa['unitID'])throw Y('unitID\x20is\x20required');if(!Tn['has'](_0x5934aa['type']))throw Y('Unsupported\x20Unit\x20type');if(!Number['isSafeInteger'](_0x5934aa['baseRev'])||_0x5934aa['baseRev']<0x1)throw Y('baseRev\x20must\x20be\x20a\x20positive\x20safe\x20integer');if(!_0x5934aa['sid'])throw Y('sid\x20is\x20required');if(!Number['isSafeInteger'](_0x5934aa['reqId'])||_0x5934aa['reqId']<0x1)throw Y('reqId\x20must\x20be\x20a\x20positive\x20safe\x20integer');if(!Array['isArray'](_0x5934aa['mutations']))throw Y('changeset\x20mutations\x20must\x20be\x20an\x20array');}var Tn=new Set([c['UniverType']['UNIVER_SHEET'],c['UniverType']['UNIVER_DOC'],c['UniverType']['UNIVER_SLIDE'],c['UniverType']['UNIVER_BOARD'],c['UniverType']['UNIVER_BASE']]);function q(_0x2c2c40,_0x59b63d,_0x2fa2fb=!0x1){if(_0x2c2c40['unitID']!==_0x59b63d['unitID']||_0x2c2c40['type']!==_0x59b63d['type']||_0x2c2c40['sid']!==_0x59b63d['sid']||_0x2c2c40['reqId']!==_0x59b63d['reqId']||!Number['isSafeInteger'](_0x2c2c40['baseRev'])||_0x2c2c40['baseRev']<0x1||!Number['isSafeInteger'](_0x2c2c40['revision'])||_0x2c2c40['revision']!==_0x2c2c40['baseRev']+0x1||_0x2fa2fb&&(_0x2c2c40['baseRev']!==_0x59b63d['baseRev']||_0x2c2c40['revision']!==_0x59b63d['revision']||_0x2c2c40['userID']!==_0x59b63d['userID']||_0x2c2c40['memberID']!==_0x59b63d['memberID']))throw X('Database\x20returned\x20an\x20invalid\x20committed\x20changeset');}function En(_0x36258a,_0x576f73){return _0x36258a['find'](_0x410657=>_0x410657['sid']===_0x576f73['sid']&&_0x410657['reqId']===_0x576f73['reqId']);}function Dn(_0x3fbd46){try{return new TextEncoder()['encode'](JSON['stringify'](_0x3fbd46))['byteLength'];}catch{return _0x3fbd46['mutationSize']??0x0;}}function J(_0x484fe4){return _0x484fe4['mutations']['some'](_0x4d8027=>_0x4d8027['id']==='univer.mutation.revert-version');}function Y(_0x3b025b){return new S('INVALID_REQUEST',_0x3b025b);}function X(_0x1303fd){return new S('ADAPTER_FAILURE',_0x1303fd,{'retryable':!0x0});}function On(_0x2e0509){return _0x2e0509 instanceof Error?_0x2e0509['message']:String(_0x2e0509);}var kn=class{['_queues']=new Map();async['runExclusive'](_0x34c3b7,_0x38ecd7){let _0x9d8d97=this['_queues']['get'](_0x34c3b7)??{'tail':Promise['resolve'](),'pending':0x0};_0x9d8d97['pending']+=0x1,this['_queues']['set'](_0x34c3b7,_0x9d8d97);let _0x1d005a=_0x9d8d97['tail'],_0x6518e5;_0x9d8d97['tail']=new Promise(_0x6cdfdf=>{_0x6518e5=_0x6cdfdf;}),await _0x1d005a;try{return await _0x38ecd7();}finally{_0x6518e5(),--_0x9d8d97['pending'],_0x9d8d97['pending']===0x0&&this['_queues']['get'](_0x34c3b7)===_0x9d8d97&&this['_queues']['delete'](_0x34c3b7);}}['runExclusiveMany'](_0x4614be,_0x12e108){let _0x567954=[...new Set(_0x4614be)]['sort'](),_0x4b2876=_0x14dfe3=>{let _0x45e53d=_0x567954[_0x14dfe3];return _0x45e53d===void 0x0?_0x12e108():this['runExclusive'](_0x45e53d,()=>_0x4b2876(_0x14dfe3+0x1));};return _0x4b2876(0x0);}},An=class{['_onListenerError'];['_listeners']=new Map();constructor(_0x2e0aaf){this['_onListenerError']=_0x2e0aaf;}['on'](_0x4cfe08,_0x4f499f){let _0x337556=this['_listeners']['get'](_0x4cfe08)??[],_0x58f6a8=_0x4f499f;_0x337556['push'](_0x58f6a8),this['_listeners']['set'](_0x4cfe08,_0x337556);let _0x5a6b4d=!0x1;return{'dispose':()=>{if(_0x5a6b4d)return;_0x5a6b4d=!0x0;let _0x5093a2=_0x337556['indexOf'](_0x58f6a8);_0x5093a2>=0x0&&_0x337556['splice'](_0x5093a2,0x1);}};}async['emit'](_0x20b8f3,_0x1e6f1c){let _0x129b86=[...this['_listeners']['get'](_0x20b8f3)??[]];for(let _0x9348a0 of _0x129b86)try{await _0x9348a0(_0x1e6f1c);}catch(_0x1e2bd3){try{this['_onListenerError'](_0x1e2bd3);}catch{}}}['clear'](){this['_listeners']['clear']();}},jn=class{['_owner'];['_state']='running';['_activeCalls']=0x0;['_drainPromise'];['_resolveDrain'];['_disposePromise'];constructor(_0x507e2a){this['_owner']=_0x507e2a;}get['state'](){return this['_state'];}['run'](_0x34ed8a){return this['_state']==='running'?(this['_activeCalls']+=0x1,Promise['resolve']()['then'](_0x34ed8a)['finally'](()=>{--this['_activeCalls'],this['_activeCalls']===0x0&&(this['_resolveDrain']?.(),this['_resolveDrain']=void 0x0,this['_drainPromise']=void 0x0);})):Promise['reject'](new S('INTERNAL_ERROR',this['_owner']+'\x20is\x20'+this['_state'],{'retryable':!0x0}));}['dispose'](_0x546f9a){return this['_disposePromise']?this['_disposePromise']:(this['_state']='disposing',this['_disposePromise']=this['_finishDispose'](_0x546f9a),this['_disposePromise']);}async['_finishDispose'](_0x42964b){this['_activeCalls']>0x0&&(this['_drainPromise']=new Promise(_0x4afacf=>{this['_resolveDrain']=_0x4afacf;}),await this['_drainPromise']);try{await _0x42964b();}finally{this['_state']='disposed';}}},Mn=new Set([c['UniverType']['UNIVER_SHEET'],c['UniverType']['UNIVER_DOC'],c['UniverType']['UNIVER_SLIDE'],c['UniverType']['UNIVER_BOARD'],c['UniverType']['UNIVER_BASE']]),Nn=0x64,Pn=class{['_dbAdapter'];['_middleware']=new ze();['_lifecycle']=new jn('Collaboration\x20Service');['_logger'];['_metrics'];['_events'];['_runtime'];['_coordinator'];['_submitEngine'];constructor(_0x4b69ca){if(!_0x4b69ca?.['dbAdapter'])throw TypeError('UniverCollabService\x20requires\x20a\x20dbAdapter');this['_dbAdapter']=_0x4b69ca['dbAdapter'],this['_logger']=He(_0x4b69ca['logger']),this['_metrics']=Ue(_0x4b69ca['metrics']),this['_events']=new An(_0x57320f=>{this['_logger']['error']('Collaboration\x20Service\x20event\x20listener\x20failed',{'error':Un(_0x57320f)});});let _0x96b3e0=_0x4b69ca['submitChangeset']?.['maxRevisionRetries']??0x3;if(!Number['isSafeInteger'](_0x96b3e0)||_0x96b3e0<0x0)throw TypeError('submitChangeset.maxRevisionRetries\x20must\x20be\x20a\x20non-negative\x20safe\x20integer');this['_runtime']=new K({'reader':this['_dbAdapter'],..._0x4b69ca['runtime']?.['maxLoadedUnits']===void 0x0?{}:{'maxLoadedUnits':_0x4b69ca['runtime']['maxLoadedUnits']},..._0x4b69ca['runtime']?.['idleTimeoutMs']===void 0x0?{}:{'idleTimeoutMs':_0x4b69ca['runtime']['idleTimeoutMs']}}),this['_coordinator']=new kn(),this['_submitEngine']=new Cn({'dbAdapter':this['_dbAdapter'],'middleware':this['_middleware'],'runtime':this['_runtime'],'transformer':this['_runtime']['changesetTransformer'],'coordinator':this['_coordinator'],..._0x4b69ca['snapshotPolicy']===!0x1?{}:{'snapshotPolicy':_0x4b69ca['snapshotPolicy']??Ie},'enableUnitPermissionAnalysis':_0x4b69ca['enableUnitPermissionAnalysis']??!0x1,'maxRevisionRetries':_0x96b3e0,'logger':this['_logger'],'metrics':this['_metrics'],'onCommitted':(_0x58d48a,_0x5b6458,_0x4481d8,_0x220982)=>this['_events']['emit']('changesetCommitted',{'userID':_0x58d48a['userID'],'memberID':_0x58d48a['memberID'],'customData':_0x58d48a['customData'],'request':_0x5b6458,'changeset':_0x4481d8,'requiredUnitPermissions':_0x220982,'committedAt':Date['now']()})});}get['dbAdapter'](){return this['_dbAdapter'];}['use'](_0x24790d,_0x15e39d){return this['_assertRunning'](),this['_middleware']['use'](_0x24790d,_0x15e39d);}['on'](_0x3879bc,_0x23aab8){return this['_assertRunning'](),this['_events']['on'](_0x3879bc,_0x23aab8);}['getUnitLoadData'](_0x1c7341,_0xb183cc){return this['_call']('getUnitLoadData',async()=>{let _0x2c8e80=C(_0xb183cc),_0x2b9c8c=We(_0x1c7341),_0x2b4a88={..._0x2c8e80,'request':_0x2b9c8c},_0x16df59;return await this['_middleware']['run']('readUnitData',_0x2b4a88,async()=>{_0x16df59=await this['_getUnitLoadData'](_0x2b4a88,_0x1c7341);}),_0x16df59;});}['getUnitLoadDataWithBlocks'](_0x556ad4,_0x4f175d){return this['_call']('getUnitLoadDataWithBlocks',async()=>{let _0x2a4717=C(_0x4f175d),_0x1fb071=We(_0x556ad4),_0x292e6c={..._0x2a4717,'request':_0x1fb071},_0x5cd19f;return await this['_middleware']['run']('readUnitData',_0x292e6c,async()=>{let _0x548627=await this['_getUnitLoadData'](_0x292e6c,_0x556ad4),_0xcf2467=await this['_getSnapshotSheetBlocks'](_0x292e6c,_0x548627['snapshot']);_0x5cd19f={..._0x548627,'sheetBlocks':_0xcf2467};}),_0x5cd19f;});}['getChangesets'](_0x4141dd,_0x5430dc){return this['_call']('getChangesets',async()=>{let _0x60e572=C(_0x5430dc),_0x1fc03f=Ge(_0x4141dd),_0x54bbef={..._0x60e572,'request':_0x1fc03f},_0x21fc09;return await this['_middleware']['run']('readUnitData',_0x54bbef,async()=>{Z(_0x4141dd['unitID'],_0x4141dd['type']),zn('from',_0x4141dd['from']),zn('to',_0x4141dd['to']);let _0x51c379=await this['_requireUnit'](_0x54bbef,_0x4141dd['unitID'],_0x4141dd['type']),_0x60c4cb=_0x4141dd['to']===0x0?void 0x0:Bn(_0x4141dd['to'],_0x51c379);if(_0x4141dd['from']>(_0x60c4cb??_0x51c379['headRevision']))throw Q('Changeset\x20range\x20starts\x20after\x20its\x20target');let _0x20dc6=await this['_database'](()=>this['_dbAdapter']['getChangesets'](_0x54bbef,_0x4141dd['unitID'],{'from':_0x4141dd['from'],..._0x60c4cb===void 0x0?{}:{'to':_0x60c4cb}}));if(_0x20dc6===null)throw new S('UNIT_NOT_FOUND','Unit\x20'+_0x4141dd['unitID']+'\x20does\x20not\x20exist');Vn(_0x20dc6,_0x4141dd['unitID'],_0x4141dd['type'],Math['max'](_0x4141dd['from']+0x1,0x2),_0x60c4cb),_0x21fc09={'changesets':_0x20dc6};}),_0x21fc09;});}['getSheetBlock'](_0x26e175,_0x3c88cb){return this['_call']('getSheetBlock',async()=>{let _0x49d508=C(_0x3c88cb),_0x3492b9=Ke(_0x26e175),_0x252d49={..._0x49d508,'request':_0x3492b9},_0x270209;return await this['_middleware']['run']('readUnitData',_0x252d49,async()=>{if(Z(_0x26e175['unitID'],_0x26e175['type']),!_0x26e175['blockID'])throw Q('blockID\x20is\x20required');await this['_requireUnit'](_0x252d49,_0x26e175['unitID'],_0x26e175['type']),_0x270209={'block':await this['_database'](()=>this['_dbAdapter']['getSheetBlock'](_0x252d49,_0x26e175['unitID'],_0x26e175['blockID']))};}),_0x270209;});}['createUnitFromSnapshot'](_0x3a1b9e,_0x12d45b){return this['_call']('createUnitFromSnapshot',()=>this['_createUnit'](_0x3a1b9e,C(_0x12d45b)));}['createUnitFromData'](_0x2b6e2f,_0x2400d6){return this['_call']('createUnitFromData',async()=>{if(!_0x2b6e2f||!Mn['has'](_0x2b6e2f['type']))throw Q('Unsupported\x20unit\x20type');if(!_0x2b6e2f['data']?.['id'])throw Q('data.id\x20is\x20required');if(_0x2b6e2f['data']['rev']!==0x1)throw Q('Initial\x20Unit\x20data\x20revision\x20must\x20be\x201');let _0x33e03b=C(_0x2400d6),_0xf761bb=await Ze(_0x2b6e2f);return this['_createUnit'](_0xf761bb,_0x33e03b);});}['deleteUnits'](_0x4db611,_0x3a1320){return this['_call']('deleteUnits',async()=>{let _0xb19a68=C(_0x3a1320),_0x3dabb8=Fn(_0x4db611?.['unitIDs']);if(_0x4db611['hardDelete']!==void 0x0&&typeof _0x4db611['hardDelete']!='boolean')throw Q('hardDelete\x20must\x20be\x20a\x20boolean');let _0x4dd9c7=Je({'unitIDs':_0x3dabb8,'hardDelete':_0x4db611['hardDelete']??!0x1}),_0x3a770e={..._0xb19a68,'request':_0x4dd9c7},_0x95fd;return await this['_coordinator']['runExclusiveMany'](_0x3dabb8,()=>this['_middleware']['run']('deleteUnits',_0x3a770e,async()=>{let _0x42d085=await this['_database'](()=>this['_dbAdapter']['deleteUnits'](_0x3a770e,{'unitIDs':_0x3dabb8,'hardDelete':_0x4dd9c7['hardDelete']}));for(let _0x3048bb of _0x3dabb8)this['_runtime']['disposeUnit'](_0x3048bb);In(_0x42d085,_0x3dabb8,_0x4dd9c7['hardDelete']),_0x95fd=_0x42d085,await this['_events']['emit']('unitsDeleted',{'userID':_0xb19a68['userID'],'customData':_0xb19a68['customData'],'request':_0x4dd9c7,'result':_0x42d085,'deletedAt':Date['now']()});})),_0x95fd;});}['recoverUnits'](_0x3c9b1d,_0x41a242){return this['_call']('recoverUnits',async()=>{let _0x13c5aa=C(_0x41a242),_0x3c6c5f=Fn(_0x3c9b1d?.['unitIDs']),_0x37b138=Ye({'unitIDs':_0x3c6c5f}),_0x471df5={..._0x13c5aa,'request':_0x37b138},_0x28b5ac;return await this['_coordinator']['runExclusiveMany'](_0x3c6c5f,()=>this['_middleware']['run']('recoverUnits',_0x471df5,async()=>{let _0x5a8743=await this['_database'](()=>this['_dbAdapter']['recoverUnits'](_0x471df5,{'unitIDs':_0x3c6c5f}));Ln(_0x5a8743,_0x3c6c5f),_0x28b5ac=_0x5a8743,await this['_events']['emit']('unitsRecovered',{'userID':_0x13c5aa['userID'],'customData':_0x13c5aa['customData'],'request':_0x37b138,'result':_0x5a8743,'recoveredAt':Date['now']()});})),_0x28b5ac;});}async['submitChangeset'](_0x250851,_0x35e70f){try{return await this['_lifecycle']['run'](async()=>{let _0x345b7e=Le(_0x35e70f),_0x2b0394=Xe(_0x250851,_0x345b7e);_0x2b0394['changeset']['createTime']??=Math['floor'](Date['now']()/0x3e8);let _0x406938={..._0x345b7e,'request':_0x2b0394},_0x45cc42;return await this['_middleware']['run']('submitChangeset',_0x406938,async()=>{_0x45cc42=await this['_submitEngine']['submit'](_0x406938,_0x2b0394);}),_0x45cc42;});}catch(_0x391b19){let _0x187b22=this['_normalizeError']('submitChangeset',_0x391b19);return{'status':_0x187b22['retryable']?'retry':'rejected','error':_0x187b22};}}['dispose'](){return this['_lifecycle']['dispose'](async()=>{this['_middleware']['clear'](),this['_events']['clear'](),await this['_runtime']['dispose']();});}async['_getUnitLoadData'](_0x41dcfa,_0x366b2a){Z(_0x366b2a['unitID'],_0x366b2a['type']),zn('revision',_0x366b2a['revision']);let _0x5ac6f8=await this['_requireUnit'](_0x41dcfa,_0x366b2a['unitID'],_0x366b2a['type']),_0x5becbf=Bn(_0x366b2a['revision'],_0x5ac6f8),_0x5a0186=await this['_database'](()=>this['_dbAdapter']['getSnapshot'](_0x41dcfa,_0x366b2a['unitID'],{'revision':_0x5becbf}));if(!_0x5a0186)throw new S('ADAPTER_FAILURE','Database\x20returned\x20a\x20unit\x20without\x20a\x20recoverable\x20snapshot',{'retryable':!0x0});if(_0x5a0186['unitID']!==_0x366b2a['unitID']||_0x5a0186['type']!==_0x366b2a['type']||!Number['isSafeInteger'](_0x5a0186['rev'])||_0x5a0186['rev']<0x1||_0x5a0186['rev']>_0x5becbf)throw new S('ADAPTER_FAILURE','Database\x20returned\x20an\x20invalid\x20snapshot',{'retryable':!0x0});let _0x1ef9b6=await this['_database'](()=>this['_dbAdapter']['getChangesets'](_0x41dcfa,_0x366b2a['unitID'],{'from':_0x5a0186['rev'],'to':_0x5becbf}));if(_0x1ef9b6===null)throw new S('UNIT_NOT_FOUND','Unit\x20'+_0x366b2a['unitID']+'\x20does\x20not\x20exist');return Vn(_0x1ef9b6,_0x366b2a['unitID'],_0x366b2a['type'],_0x5a0186['rev']+0x1,_0x5becbf),{'snapshot':_0x5a0186,'changesets':_0x1ef9b6,'targetRevision':_0x5becbf};}async['_getSnapshotSheetBlocks'](_0x1a7f6c,_0x18439e){let _0x2bcd90=et(_0x18439e);return Promise['all'](_0x2bcd90['map'](async _0x5980d5=>{let _0xee0573=await this['_database'](()=>this['_dbAdapter']['getSheetBlock'](_0x1a7f6c,_0x18439e['unitID'],_0x5980d5));if(!_0xee0573||_0xee0573['id']!==_0x5980d5)throw Hn('Database\x20returned\x20an\x20invalid\x20referenced\x20Sheet\x20block\x20'+_0x5980d5);return _0xee0573;}));}async['_createUnit'](_0x1dc689,_0x16d463){let _0x5c0f79=qe(_0x1dc689),_0x583a00={..._0x16d463,'request':_0x5c0f79},_0x4787cf,{snapshot:_0xe56b88}=_0x1dc689;return await this['_coordinator']['runExclusive'](_0xe56b88['unitID'],()=>this['_middleware']['run']('createUnit',_0x583a00,async()=>{if(Z(_0xe56b88['unitID'],_0xe56b88['type']),_0xe56b88['rev']!==0x1)throw Q('Initial\x20snapshot\x20revision\x20must\x20be\x201');let _0x4ec094=await this['_database'](()=>this['_dbAdapter']['createUnit'](_0x583a00,{'record':{'unitID':_0xe56b88['unitID'],'type':_0xe56b88['type'],'headRevision':0x1,'creatorID':_0x16d463['userID'],'createdAt':Date['now']()},'snapshot':_0xe56b88,..._0x1dc689['sheetBlocks']===void 0x0?{}:{'sheetBlocks':_0x1dc689['sheetBlocks']}}));if(_0x4ec094['record']['unitID']!==_0xe56b88['unitID']||_0x4ec094['record']['type']!==_0xe56b88['type']||!Number['isSafeInteger'](_0x4ec094['record']['headRevision'])||_0x4ec094['record']['headRevision']<0x1)throw new S('ADAPTER_FAILURE','Database\x20returned\x20an\x20invalid\x20created\x20unit\x20record',{'retryable':!0x0});_0x4787cf={'status':_0x4ec094['status'],'unitID':_0x4ec094['record']['unitID'],'headRevision':_0x4ec094['record']['headRevision']},_0x4ec094['status']==='created'&&await this['_events']['emit']('unitCreated',{'userID':_0x16d463['userID'],'customData':_0x16d463['customData'],'request':_0x5c0f79,'record':_0x4ec094['record'],'createdAt':Date['now']()});})),_0x4787cf;}async['_requireUnit'](_0x468ef7,_0x1949ab,_0x58b5df){let _0x2426a6=await this['_database'](()=>this['_dbAdapter']['getUnit'](_0x468ef7,_0x1949ab));if(!_0x2426a6)throw new S('UNIT_NOT_FOUND','Unit\x20'+_0x1949ab+'\x20does\x20not\x20exist');if(_0x2426a6['unitID']!==_0x1949ab)throw new S('ADAPTER_FAILURE','Database\x20returned\x20Unit\x20metadata\x20for\x20a\x20different\x20identity',{'retryable':!0x0});if(_0x2426a6['type']!==_0x58b5df)throw Q('Unit\x20type\x20does\x20not\x20match\x20the\x20stored\x20unit');if(!Number['isSafeInteger'](_0x2426a6['headRevision'])||_0x2426a6['headRevision']<0x1)throw new S('ADAPTER_FAILURE','Database\x20returned\x20an\x20invalid\x20unit\x20head\x20revision',{'retryable':!0x0});return _0x2426a6;}async['_database'](_0x4cdf0c){try{return await _0x4cdf0c();}catch(_0x18ef87){throw _0x18ef87 instanceof S?_0x18ef87:new S('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x18ef87});}}async['_call'](_0x360aeb,_0x9759f7){try{return this['_metrics']['increment']('collaboration.service.call',{'operation':_0x360aeb}),await this['_lifecycle']['run'](_0x9759f7);}catch(_0x484f9b){throw this['_normalizeError'](_0x360aeb,_0x484f9b);}}['_normalizeError'](_0xda1015,_0xda78db){return _0xda78db instanceof S?_0xda78db:(this['_logger']['error']('Collaboration\x20Service\x20operation\x20failed',{'operation':_0xda1015,'error':Un(_0xda78db)}),new S('INTERNAL_ERROR','Collaboration\x20Service\x20failed',{'retryable':!0x0,'cause':_0xda78db}));}['_assertRunning'](){if(this['_lifecycle']['state']!=='running')throw new S('INTERNAL_ERROR','Collaboration\x20Service\x20is\x20'+this['_lifecycle']['state'],{'retryable':!0x0});}};function Z(_0x4d1959,_0x1dfd4a){if(!_0x4d1959)throw Q('unitID\x20is\x20required');if(!Mn['has'](_0x1dfd4a))throw Q('Unsupported\x20unit\x20type');}function Fn(_0x292f08){if(!Array['isArray'](_0x292f08)||_0x292f08['length']===0x0)throw Q('unitIDs\x20must\x20be\x20a\x20non-empty\x20array');if(_0x292f08['length']>0x64)throw Q('unitIDs\x20cannot\x20contain\x20more\x20than\x20100\x20values');let _0x404d8f=[],_0x4930a5=new Set();for(let _0x3cad62 of _0x292f08){if(typeof _0x3cad62!='string'||_0x3cad62['trim']()['length']===0x0)throw Q('unitIDs\x20cannot\x20contain\x20empty\x20values');_0x4930a5['has'](_0x3cad62)||(_0x4930a5['add'](_0x3cad62),_0x404d8f['push'](_0x3cad62));}return _0x404d8f;}function In(_0xda2e80,_0x20a14d,_0x4997b4){let _0x3cd947=_0x4997b4?new Set(['hard-deleted','already-hard-deleted']):new Set(['soft-deleted','already-soft-deleted']);Rn(_0xda2e80?.['units'],_0x20a14d,_0x3cd947,'delete');}function Ln(_0x31c771,_0x190ee4){let _0x2452e2=new Set(['recovered','already-active']);Rn(_0x31c771?.['units'],_0x190ee4,_0x2452e2,'recover');}function Rn(_0x1bafb7,_0x3dbbfe,_0x38ae7c,_0xc1d45d){if(!Array['isArray'](_0x1bafb7)||_0x1bafb7['length']!==_0x3dbbfe['length'])throw Hn('Database\x20returned\x20incomplete\x20'+_0xc1d45d+'\x20Unit\x20results');for(let [_0x33ede7,_0x32ddec]of _0x1bafb7['entries']())if(!_0x32ddec||_0x32ddec['unitID']!==_0x3dbbfe[_0x33ede7]||!_0x38ae7c['has'](_0x32ddec['status']))throw Hn('Database\x20returned\x20invalid\x20'+_0xc1d45d+'\x20Unit\x20results');}function zn(_0x2e6251,_0x312fbe){if(!Number['isSafeInteger'](_0x312fbe)||_0x312fbe<0x0)throw Q(_0x2e6251+'\x20must\x20be\x20a\x20non-negative\x20safe\x20integer');}function Bn(_0x423a66,_0x24c792){let _0x358838=_0x423a66===0x0?_0x24c792['headRevision']:_0x423a66;if(_0x358838<0x1||_0x358838>_0x24c792['headRevision'])throw Q('Requested\x20revision\x20is\x20outside\x20the\x20stored\x20unit\x20history');return _0x358838;}function Vn(_0x20cc23,_0x466ec0,_0x5ed723,_0x37ed5e,_0x42b624){let _0x1a51e4=_0x37ed5e;for(let _0x91d196 of _0x20cc23){if(_0x91d196['unitID']!==_0x466ec0||_0x91d196['type']!==_0x5ed723||_0x91d196['baseRev']!==_0x1a51e4-0x1||_0x91d196['revision']!==_0x1a51e4)throw new S('ADAPTER_FAILURE','Database\x20returned\x20a\x20non-contiguous\x20changeset\x20history',{'retryable':!0x0});_0x1a51e4+=0x1;}if(_0x42b624!==void 0x0&&_0x1a51e4-0x1!==_0x42b624)throw new S('ADAPTER_FAILURE','Database\x20returned\x20an\x20incomplete\x20changeset\x20history',{'retryable':!0x0});}function Q(_0x11f72b){return new S('INVALID_REQUEST',_0x11f72b);}function Hn(_0x59ed11){return new S('ADAPTER_FAILURE',_0x59ed11,{'retryable':!0x0});}function Un(_0x7bf78c){return _0x7bf78c instanceof Error?_0x7bf78c['message']:String(_0x7bf78c);}var Wn=class{['_reader']=new Gn();['_runtime']=new K({'reader':this['_reader']});['_coordinator']=new kn();['_lifecycle']=new jn('Unit\x20Snapshot\x20Materializer');['materializeSnapshot'](_0x336740){return this['_lifecycle']['run'](async()=>{Kn(_0x336740);let {snapshot:_0x3d950d,targetRevision:_0x147ed4}=_0x336740;return this['_coordinator']['runExclusive'](_0x3d950d['unitID'],async()=>{this['_runtime']['disposeUnit'](_0x3d950d['unitID']),this['_reader']['bind'](_0x336740);let _0xaa3ca1={'userID':'unit-snapshot-materializer','customData':Object['create'](null),'request':Object['create'](null)},_0x50e89e;try{_0x50e89e=await this['_runtime']['ensureUnit'](_0xaa3ca1,_0x3d950d['unitID'],_0x3d950d['type']);let _0x1cb494=await this['_runtime']['createSnapshot'](_0x50e89e);if(_0x1cb494['snapshot']['unitID']!==_0x3d950d['unitID']||_0x1cb494['snapshot']['type']!==_0x3d950d['type']||_0x1cb494['snapshot']['rev']!==_0x147ed4)throw new S('INTERNAL_ERROR','Unit\x20Runtime\x20materialized\x20an\x20unexpected\x20snapshot\x20revision',{'retryable':!0x0});return{'snapshot':_0x1cb494['snapshot'],'sheetBlocks':[..._0x1cb494['sheetBlocks']??[]]};}finally{_0x50e89e&&this['_runtime']['releaseUnit'](_0x50e89e),this['_runtime']['disposeUnit'](_0x3d950d['unitID']),this['_reader']['unbind'](_0x3d950d['unitID']);}});});}['dispose'](){return this['_lifecycle']['dispose'](()=>this['_runtime']['dispose']());}},Gn=class{['_bound']=new Map();['bind'](_0x9c2a3c){let _0x50a183;try{_0x50a183={'snapshot':structuredClone(_0x9c2a3c['snapshot']),'sheetBlocks':structuredClone(_0x9c2a3c['sheetBlocks']),'changesets':structuredClone(_0x9c2a3c['changesets']),'targetRevision':_0x9c2a3c['targetRevision']};}catch(_0x34460a){throw new S('INVALID_REQUEST','Materialization\x20input\x20must\x20be\x20structured-cloneable',{'cause':_0x34460a});}this['_bound']['set'](_0x50a183['snapshot']['unitID'],{'input':_0x50a183,'blocks':new Map(_0x50a183['sheetBlocks']['map'](_0x1c9bdf=>[_0x1c9bdf['id'],_0x1c9bdf]))});}['unbind'](_0x2af3e9){this['_bound']['delete'](_0x2af3e9);}async['getUnit'](_0x1163ad,_0x5bc92b){let _0x472455=this['_bound']['get'](_0x5bc92b);return _0x472455?{'unitID':_0x5bc92b,'type':_0x472455['input']['snapshot']['type'],'headRevision':_0x472455['input']['targetRevision']}:null;}async['getSnapshot'](_0x4fceaf,_0x5204ee,_0x2f2af3){let _0x2b523b=this['_bound']['get'](_0x5204ee),_0x17ce15=_0x2f2af3?.['revision']??_0x2b523b?.['input']['targetRevision'];return _0x2b523b&&_0x17ce15!==void 0x0&&_0x2b523b['input']['snapshot']['rev']<=_0x17ce15?_0x2b523b['input']['snapshot']:null;}async['getChangesets'](_0x1a29da,_0x2f6a0f,_0x86c249){let _0x36f76f=this['_bound']['get'](_0x2f6a0f);if(!_0x36f76f)return null;let _0x37b429=Math['min'](_0x86c249['to']??_0x36f76f['input']['targetRevision'],_0x36f76f['input']['targetRevision']);return _0x36f76f['input']['changesets']['filter'](_0x3be30f=>_0x3be30f['revision']>_0x86c249['from']&&_0x3be30f['revision']<=_0x37b429);}['getSheetBlock'](_0x104d02,_0x32117f,_0xe0dd21){return Promise['resolve'](this['_require'](_0x32117f)['blocks']['get'](_0xe0dd21)??null);}['_require'](_0x515566){let _0x274e52=this['_bound']['get'](_0x515566);if(!_0x274e52)throw new S('INTERNAL_ERROR','Materialization\x20data\x20for\x20Unit\x20'+_0x515566+'\x20is\x20unavailable',{'retryable':!0x0});return _0x274e52;}};function Kn(_0x21cf05){if(!_0x21cf05||typeof _0x21cf05!='object'||!_0x21cf05['snapshot'])throw $('Materialization\x20input\x20requires\x20a\x20snapshot');let {snapshot:_0xac6254,targetRevision:_0x191e0a,changesets:_0x126164,sheetBlocks:_0x37c671}=_0x21cf05;if(typeof _0xac6254['unitID']!='string'||_0xac6254['unitID']['length']===0x0||!Number['isSafeInteger'](_0xac6254['rev'])||_0xac6254['rev']<0x1||!Number['isSafeInteger'](_0x191e0a)||_0x191e0a<_0xac6254['rev'])throw $('Materialization\x20revisions\x20are\x20invalid');if(!Array['isArray'](_0x126164)||!Array['isArray'](_0x37c671))throw $('Materialization\x20changesets\x20and\x20sheetBlocks\x20must\x20be\x20arrays');let _0x48ca6c=_0xac6254['rev']+0x1;for(let _0x3191ab of _0x126164){if(_0x3191ab['unitID']!==_0xac6254['unitID']||_0x3191ab['type']!==_0xac6254['type']||_0x3191ab['baseRev']!==_0x48ca6c-0x1||_0x3191ab['revision']!==_0x48ca6c)throw $('Materialization\x20changesets\x20are\x20not\x20contiguous');_0x48ca6c+=0x1;}if(_0x48ca6c-0x1!==_0x191e0a)throw $('Materialization\x20changesets\x20do\x20not\x20reach\x20targetRevision');let _0xd0c551=new Map();for(let _0x59b648 of _0x37c671){if(!_0x59b648||typeof _0x59b648['id']!='string'||_0x59b648['id']['length']===0x0||_0xd0c551['has'](_0x59b648['id']))throw $('Materialization\x20Sheet\x20blocks\x20are\x20invalid');_0xd0c551['set'](_0x59b648['id'],_0x59b648);}for(let _0x5336a8 of et(_0xac6254))if(!_0xd0c551['has'](_0x5336a8))throw $('Materialization\x20is\x20missing\x20Sheet\x20block\x20'+_0x5336a8);}function $(_0x59ab79){return new S('INVALID_REQUEST',_0x59ab79);}exports['CollabError']=S,exports['MAX_UNIT_LIFECYCLE_BATCH_SIZE']=Nn,exports['UnitSnapshotMaterializer']=Wn,exports['UniverCollabService']=Pn,exports['UniverUnitRuntime']=K;
|
|
1
|
+
Object['defineProperty'](exports,Symbol['toStringTag'],{'value':'Module'});var e=Object['create'],t=Object['defineProperty'],n=Object['getOwnPropertyDescriptor'],r=Object['getOwnPropertyNames'],i=Object['getPrototypeOf'],a=Object['prototype']['hasOwnProperty'],o=(_0x5dd18a,_0x363f96,_0x4ad464,_0x239a87)=>{if(_0x363f96&&typeof _0x363f96=='object'||typeof _0x363f96=='function'){for(var _0x15cd24=r(_0x363f96),_0x120ac2=0x0,_0x5d9cc3=_0x15cd24['length'],_0x2c3cfa;_0x120ac2<_0x5d9cc3;_0x120ac2++)_0x2c3cfa=_0x15cd24[_0x120ac2],!a['call'](_0x5dd18a,_0x2c3cfa)&&_0x2c3cfa!==_0x4ad464&&t(_0x5dd18a,_0x2c3cfa,{'get':(_0x31b4fd=>_0x363f96[_0x31b4fd])['bind'](null,_0x2c3cfa),'enumerable':!(_0x239a87=n(_0x363f96,_0x2c3cfa))||_0x239a87['enumerable']});}return _0x5dd18a;},s=(_0x2988b7,_0x2c79a5,_0x4ed5ac)=>(_0x4ed5ac=_0x2988b7==null?{}:e(i(_0x2988b7)),o(_0x2c79a5||!_0x2988b7||!_0x2988b7['__esModule']?t(_0x4ed5ac,'default',{'value':_0x2988b7,'enumerable':!0x0}):_0x4ed5ac,_0x2988b7));let c=require('@univerjs/protocol'),l=require('@univerjs-pro/collaboration'),u=require('@univerjs/core'),d=require('@univerjs/engine-formula'),f=require('@univerjs/sheets/locale/en-US');f=s(f,0x1);let p=require('@univerjs-pro/bases'),ee=require('@univerjs-pro/boards'),m=require('@univerjs/docs'),h=require('@univerjs/sheets'),g=require('@univerjs/sheets-conditional-formatting'),_=require('@univerjs/data-validation'),te=require('@univerjs/sheets-filter'),v=require('@univerjs/thread-comment'),y=require('@univerjs-pro/slides-chart'),b=require('@univerjs-pro/slides'),x=require('@univerjs-pro/slides-table'),ne=require('node:async_hooks'),re=require('@univerjs-pro/bases-dashboard'),ie=require('@univerjs-pro/bases-thread-comment'),ae=require('@univerjs-pro/boards-chart'),oe=require('@univerjs-pro/boards-mind'),se=require('@univerjs-pro/boards-table'),ce=require('@univerjs-pro/boards-thread-comment'),le=require('@univerjs-pro/docs-callout'),ue=require('@univerjs-pro/docs-chart'),de=require('@univerjs-pro/docs-code'),fe=require('@univerjs-pro/docs-latex'),pe=require('@univerjs-pro/docs-shape'),me=require('@univerjs-pro/docs-table'),he=require('@univerjs-pro/embed'),ge=require('@univerjs-pro/engine-formula-rust'),_e=require('@univerjs-pro/sheets-chart'),ve=require('@univerjs-pro/sheets-outline'),ye=require('@univerjs-pro/sheets-pivot'),be=require('@univerjs-pro/sheets-shape'),xe=require('@univerjs-pro/sheets-sparkline'),Se=require('@univerjs-pro/slides-thread-comment'),Ce=require('@univerjs-pro/thread-comment-resource'),we=require('@univerjs/docs-drawing'),Te=require('@univerjs/docs-hyper-link'),Ee=require('@univerjs/docs-thread-comment'),De=require('@univerjs/drawing'),Oe=require('@univerjs/sheets-drawing'),ke=require('@univerjs/sheets-formula'),Ae=require('@univerjs/sheets-hyper-link'),je=require('@univerjs/sheets-note'),Me=require('@univerjs/sheets-sort'),Ne=require('@univerjs/sheets-table'),Pe=require('@univerjs/sheets-thread-comment');var S=class extends Error{['code'];['retryable'];['details'];constructor(_0xfb73bb,_0x5e4d7a,_0x3fa9ef={}){super(_0x5e4d7a,{'cause':_0x3fa9ef['cause']}),this['name']='CollabError',this['code']=_0xfb73bb,this['retryable']=_0x3fa9ef['retryable']??!0x1,_0x3fa9ef['details']!==void 0x0&&(this['details']=_0x3fa9ef['details']);}},Fe=0xa*0x400*0x400,Ie={'shouldCreate'(_0x2a994b){if(_0x2a994b['changesetBytes']>Fe)return!0x0;let _0x3f74f1=_0x2a994b['type']===c['UniverType']['UNIVER_DOC']?0x32:_0x2a994b['type']===c['UniverType']['UNIVER_SHEET']||_0x2a994b['type']===c['UniverType']['UNIVER_SLIDE']||_0x2a994b['type']===c['UniverType']['UNIVER_BOARD']||_0x2a994b['type']===c['UniverType']['UNIVER_BASE']?0x5:0x0;return _0x3f74f1>0x0&&_0x2a994b['revision']%_0x3f74f1===0x0;}};function C(_0x1ad276){return Re(_0x1ad276),{'userID':_0x1ad276['userID'],'customData':_0x1ad276['customData']??Object['create'](null)};}function Le(_0x34d7bf){if(Re(_0x34d7bf),typeof _0x34d7bf['memberID']!='string'||_0x34d7bf['memberID']['length']===0x0)throw w('memberID\x20must\x20be\x20a\x20non-empty\x20string');return{'userID':_0x34d7bf['userID'],'memberID':_0x34d7bf['memberID'],'customData':_0x34d7bf['customData']??Object['create'](null)};}function Re(_0xb1c5c6){if(!_0xb1c5c6||typeof _0xb1c5c6!='object')throw w('context\x20must\x20be\x20an\x20object');if(typeof _0xb1c5c6['userID']!='string'||_0xb1c5c6['userID']['length']===0x0)throw w('userID\x20must\x20be\x20a\x20non-empty\x20string');if(_0xb1c5c6['customData']!==void 0x0&&(_0xb1c5c6['customData']===null||typeof _0xb1c5c6['customData']!='object'||Array['isArray'](_0xb1c5c6['customData'])))throw w('customData\x20must\x20be\x20an\x20object');}function w(_0x399ede){return new S('INVALID_REQUEST',_0x399ede);}var ze=class{['_middlewares']=new Map();['use'](_0x3b77b7,_0x42c58e){let _0x811308=this['_middlewares']['get'](_0x3b77b7)??[],_0x2e32c6=_0x42c58e;_0x811308['push'](_0x2e32c6),this['_middlewares']['set'](_0x3b77b7,_0x811308);let _0xa83a33=!0x1;return{'dispose':()=>{if(_0xa83a33)return;_0xa83a33=!0x0;let _0x2ddf35=_0x811308['indexOf'](_0x2e32c6);_0x2ddf35>=0x0&&_0x811308['splice'](_0x2ddf35,0x1);}};}async['run'](_0x17a26d,_0x62cca9,_0x51b82d){let _0x294f76=[...this['_middlewares']['get'](_0x17a26d)??[]],_0x5721d5=async _0x466949=>{let _0x426c04=_0x294f76[_0x466949];if(!_0x426c04){await _0x51b82d();return;}let _0x108634=!0x1,_0x2e17e9,_0x1ba228=()=>{if(_0x108634)throw Error('Middleware\x20for\x20action\x20'+String(_0x17a26d)+'\x20called\x20next()\x20more\x20than\x20once');return _0x108634=!0x0,_0x2e17e9=_0x5721d5(_0x466949+0x1),_0x2e17e9;};try{await _0x426c04(_0x62cca9,_0x1ba228);}catch(_0x5eaf26){if(_0x2e17e9)try{await _0x2e17e9;}catch{}throw _0x5eaf26;}if(!_0x108634)throw Error('Middleware\x20for\x20action\x20'+String(_0x17a26d)+'\x20completed\x20without\x20calling\x20next()');await _0x2e17e9;};await _0x5721d5(0x0);}['clear'](){this['_middlewares']['clear']();}},Be={'debug':()=>void 0x0,'info':()=>void 0x0,'warn':()=>void 0x0,'error':()=>void 0x0},Ve={'increment':()=>void 0x0,'observe':()=>void 0x0};function He(_0xa7de){return _0xa7de?{'debug':(..._0x11193f)=>T(()=>_0xa7de['debug'](..._0x11193f)),'info':(..._0x359f1b)=>T(()=>_0xa7de['info'](..._0x359f1b)),'warn':(..._0x47db27)=>T(()=>_0xa7de['warn'](..._0x47db27)),'error':(..._0x41e648)=>T(()=>_0xa7de['error'](..._0x41e648))}:Be;}function Ue(_0x553d10){return _0x553d10?{'increment':(..._0x3acb47)=>T(()=>_0x553d10['increment'](..._0x3acb47)),'observe':(..._0x322cf4)=>T(()=>_0x553d10['observe'](..._0x322cf4))}:Ve;}function T(_0x44596c){try{_0x44596c();}catch{}}function We(_0x3260fd){return{..._0x3260fd};}function Ge(_0x56f067){return{..._0x56f067};}function Ke(_0x4299aa){return{..._0x4299aa};}function qe(_0x46259e){return{..._0x46259e};}function Je(_0x3a2b3b){return{'unitIDs':_0x3a2b3b['unitIDs'],'hardDelete':_0x3a2b3b['hardDelete']??!0x1};}function Ye(_0x507ec3){return{'unitIDs':_0x507ec3['unitIDs']};}function Xe(_0x30272f,_0x33fa80){return{'changeset':{..._0x30272f['changeset'],'userID':_0x33fa80['userID'],'memberID':_0x33fa80['memberID']}};}async function Ze(_0x2386b5){let _0x3c0f35=$e(),_0x230381=(await Qe(_0x2386b5,_0x3c0f35['service']))['snapshot']??_0x3c0f35['snapshot'];if(!_0x230381||_0x230381['unitID']!==_0x2386b5['data']['id']||_0x230381['type']!==_0x2386b5['type']||_0x230381['rev']!==0x1)throw Error('SDK\x20Unit\x20data\x20transform\x20returned\x20an\x20invalid\x20snapshot');return{'snapshot':_0x230381,..._0x3c0f35['sheetBlocks']['length']>0x0?{'sheetBlocks':_0x3c0f35['sheetBlocks']}:{}};}function Qe(_0x2401e2,_0x50dd52){switch(_0x2401e2['type']){case c['UniverType']['UNIVER_SHEET']:{let _0x25bfd2=structuredClone(_0x2401e2['data']);return(0x0,l['transformWorkbookDataToSnapshot'])({},_0x25bfd2,_0x25bfd2['id'],0x1,_0x50dd52);}case c['UniverType']['UNIVER_DOC']:{let _0x523871=structuredClone(_0x2401e2['data']);return(0x0,l['transformDocumentDataToSnapshot'])({},_0x523871,_0x523871['id'],0x1,_0x50dd52);}case c['UniverType']['UNIVER_SLIDE']:{let _0x29ac1a=structuredClone(_0x2401e2['data']);return(0x0,l['transformSlideDataToSnapshot'])(_0x29ac1a['resources'],_0x29ac1a,_0x29ac1a['id'],0x1,_0x50dd52);}case c['UniverType']['UNIVER_BOARD']:{let _0x48e57a=structuredClone(_0x2401e2['data']);return(0x0,l['transformBoardDataToSnapshot'])(_0x48e57a['resources'],_0x48e57a,_0x48e57a['id'],0x1,_0x50dd52);}case c['UniverType']['UNIVER_BASE']:{let _0x39cd2e=structuredClone(_0x2401e2['data']);return(0x0,l['transformBaseDataToSnapshot'])({},_0x39cd2e,_0x39cd2e['id'],0x1,_0x50dd52);}}}function $e(){let _0x21a50a={},_0x3d94ac=[],_0x82be0b={'code':c['ErrorCode']['OK'],'message':''},_0x243d10=async(_0x25dd7f,_0x4f286b)=>{if(!_0x4f286b['snapshot'])throw Error('SDK\x20transform\x20attempted\x20to\x20save\x20an\x20empty\x20snapshot');return _0x21a50a['snapshot']=_0x4f286b['snapshot'],{'error':_0x82be0b};};return{'service':{'saveSnapshot':_0x243d10,'updateSnapshot':_0x243d10,'saveSheetBlock':async(_0xb3c4d9,_0x460b59)=>{if(!_0x460b59['block'])throw Error('SDK\x20transform\x20attempted\x20to\x20save\x20an\x20empty\x20block');return _0x3d94ac['push'](_0x460b59['block']),{'error':_0x82be0b,'blockID':_0x460b59['block']['id']};}},'sheetBlocks':_0x3d94ac,get 'snapshot'(){return _0x21a50a['snapshot'];}};}function et(_0x59befa){if(_0x59befa['type']!==c['UniverType']['UNIVER_SHEET']&&_0x59befa['type']!==c['UniverType']['UNIVER_BASE'])return[];let _0x5584a3=[],_0x47ac3=new Set();for(let _0x434cb2 of Object['values'](_0x59befa['workbook']?.['blockMeta']??{}))for(let _0x303991 of _0x434cb2['blocks'])_0x47ac3['has'](_0x303991)||(_0x47ac3['add'](_0x303991),_0x5584a3['push'](_0x303991));return _0x5584a3;}function E(_0x379f0f,_0x21bd81,_0x46a72f){let _0x38b75f=new Map(_0x46a72f['map'](_0x893b29=>[_0x893b29['objectId'],_0x893b29])),_0x552317=[];for(let _0x46a6fb of _0x21bd81){let _0x593a8d=_0x38b75f['get'](_0x46a6fb);_0x593a8d&&_0x552317['push']({'unitID':_0x379f0f,'objectID':_0x593a8d['permissionId'],'objectType':_0x593a8d['objectType'],'action':c['UnitAction']['Edit']});}return _0x552317;}function tt(_0x2e0ae1,_0xa58680,_0x517e61){if(_0x517e61==='base.mutation.apply-base-json1'&&st(_0xa58680['op']))return nt(_0x2e0ae1,_0xa58680['op']);let _0x12d8b5=new Set(),_0x589031=D(_0xa58680,'table'),_0x4b0a05=typeof _0xa58680['tableId']=='string'?_0xa58680['tableId']:_0x589031[0x0];if(_0x589031['forEach'](_0x47b5c3=>_0x12d8b5['add']((0x0,p['getBaseTablePermissionObjectId'])(_0x47b5c3))),!_0x4b0a05)return[..._0x12d8b5];let _0x4819f8=_0x2e0ae1['getSnapshot']()['tables'][_0x4b0a05],_0x208ee6=new Set(D(_0xa58680,'field')),_0x55135a=new Set(D(_0xa58680,'record')),_0x3dddea=new Set(D(_0xa58680,'view'));return ot(_0x4819f8,_0xa58680['patches'],_0x55135a,_0x208ee6),O(_0xa58680,_0x208ee6),_0x208ee6['forEach'](_0x190dd1=>_0x12d8b5['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x4b0a05,_0x190dd1))),_0x55135a['forEach'](_0x2a1f29=>_0x12d8b5['add']((0x0,p['getBaseRecordPermissionObjectId'])(_0x4b0a05,_0x2a1f29))),_0x3dddea['forEach'](_0x2059dd=>_0x12d8b5['add']((0x0,p['getBaseViewPermissionObjectId'])(_0x4b0a05,_0x2059dd))),[..._0x12d8b5];}function nt(_0xda449b,_0x1bf61a){let _0x3601a5=_0xda449b['getSnapshot'](),_0x2b84bb=new p['BaseJson1OpApplier']()['getAffectedRanges'](_0x1bf61a),_0x3f8b37=rt(_0x1bf61a),_0x49c748=new Set();return _0x2b84bb['forEach'](_0x135db7=>{let {tableId:_0x1bbd07}=_0x135db7;if(!_0x1bbd07)return;_0x49c748['add']((0x0,p['getBaseTablePermissionObjectId'])(_0x1bbd07));let _0x2deeee=_0x3601a5['tables'][_0x1bbd07],_0x52bef6=_0x135db7['recordId']??(_0x135db7['row']==null?void 0x0:_0x2deeee?.['rowId']?.[_0x135db7['row']]),_0xc759ad=_0x135db7['fieldId']??(_0x135db7['column']==null?void 0x0:_0x2deeee?.['colId']?.[_0x135db7['column']]);_0x52bef6&&_0x49c748['add']((0x0,p['getBaseRecordPermissionObjectId'])(_0x1bbd07,_0x52bef6)),_0xc759ad&&_0x49c748['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x1bbd07,_0xc759ad)),_0x135db7['viewId']&&_0x49c748['add']((0x0,p['getBaseViewPermissionObjectId'])(_0x1bbd07,_0x135db7['viewId'])),(_0x135db7['reason']==='table'||_0x3f8b37['has'](_0x1bbd07))&&_0x2deeee&&(Object['keys'](_0x2deeee['fields'])['forEach'](_0x387b0e=>_0x49c748['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x1bbd07,_0x387b0e))),Object['keys'](_0x2deeee['records'])['forEach'](_0x5ab192=>_0x49c748['add']((0x0,p['getBaseRecordPermissionObjectId'])(_0x1bbd07,_0x5ab192))),Object['keys'](_0x2deeee['views'])['forEach'](_0x2686ae=>_0x49c748['add']((0x0,p['getBaseViewPermissionObjectId'])(_0x1bbd07,_0x2686ae)))),_0x135db7['reason']==='record'&&_0x2deeee&&Object['keys'](_0x2deeee['fields'])['forEach'](_0x420dc5=>_0x49c748['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x1bbd07,_0x420dc5)));}),_0x2b84bb['length']===0x0&&at(_0x1bf61a,'tableOrder')&&Object['keys'](_0x3601a5['tables'])['forEach'](_0x13e3ab=>_0x49c748['add']((0x0,p['getBaseTablePermissionObjectId'])(_0x13e3ab))),[..._0x49c748];}function rt(_0x252420){let _0x6a84b8=new Set(),_0x38f0ba=_0x47dfe9=>{Array['isArray'](_0x47dfe9)&&_0x47dfe9['forEach']((_0x23020d,_0x40735a)=>{_0x23020d==='tables'&&typeof _0x47dfe9[_0x40735a+0x1]=='string'&&it(_0x47dfe9[_0x40735a+0x2])&&_0x6a84b8['add'](_0x47dfe9[_0x40735a+0x1]),_0x38f0ba(_0x23020d);});};return _0x38f0ba(_0x252420),_0x6a84b8;}function it(_0x3c1ae0){return!!_0x3c1ae0&&typeof _0x3c1ae0=='object'&&!Array['isArray'](_0x3c1ae0)&&('i'in _0x3c1ae0||'r'in _0x3c1ae0||'p'in _0x3c1ae0||'d'in _0x3c1ae0||'es'in _0x3c1ae0||'ena'in _0x3c1ae0||'et'in _0x3c1ae0);}function at(_0xdeeedb,_0x45a69d){return Array['isArray'](_0xdeeedb)&&_0xdeeedb['some'](_0x6ea404=>_0x6ea404===_0x45a69d||at(_0x6ea404,_0x45a69d));}function D(_0x263ae4,_0xa4c5d2){let _0x2f43b0=new Set(),_0xb6ffed=_0xa4c5d2+'Id',_0x431bf5=_0xa4c5d2+'Ids',_0x157fa4=(_0x13fbc5,_0x59a8e8='')=>{if(typeof _0x13fbc5=='string'){_0x59a8e8===_0xb6ffed&&_0x2f43b0['add'](_0x13fbc5);return;}if(Array['isArray'](_0x13fbc5)){_0x59a8e8===_0x431bf5?_0x13fbc5['forEach'](_0x493cb4=>{typeof _0x493cb4=='string'&&_0x2f43b0['add'](_0x493cb4);}):_0x13fbc5['forEach'](_0x41c261=>_0x157fa4(_0x41c261,_0x59a8e8));return;}k(_0x13fbc5)&&Object['entries'](_0x13fbc5)['forEach'](([_0x43adaf,_0x373f59])=>{_0x43adaf==='id'&&_0x59a8e8===_0xa4c5d2&&typeof _0x373f59=='string'?_0x2f43b0['add'](_0x373f59):_0x157fa4(_0x373f59,_0x43adaf);});};return _0x157fa4(_0x263ae4),[..._0x2f43b0];}function ot(_0x3dad99,_0x7d8483,_0x4b02fa,_0x3cd53e){!_0x3dad99||!Array['isArray'](_0x7d8483)||_0x7d8483['forEach'](_0x550a43=>{if(!k(_0x550a43))return;let _0x5c3ca5=_0x550a43;if(typeof _0x5c3ca5['row']=='number'){let _0x4138c9=_0x3dad99['rowId']?.[_0x5c3ca5['row']];_0x4138c9&&_0x4b02fa['add'](_0x4138c9);}if(typeof _0x5c3ca5['col']=='number'){let _0x89e387=_0x3dad99['colId']?.[_0x5c3ca5['col']];_0x89e387&&_0x3cd53e['add'](_0x89e387);}});}function O(_0x21ead1,_0x48a81c,_0x1e9e03=''){if(!(!_0x21ead1||typeof _0x21ead1!='object')){if(Array['isArray'](_0x21ead1)){_0x21ead1['forEach'](_0x3e170d=>O(_0x3e170d,_0x48a81c,_0x1e9e03));return;}k(_0x21ead1)&&Object['entries'](_0x21ead1)['forEach'](([_0x3e94f5,_0x4a6262])=>{_0x1e9e03==='values'&&_0x48a81c['add'](_0x3e94f5),O(_0x4a6262,_0x48a81c,_0x3e94f5);});}}function st(_0x284627){return Array['isArray'](_0x284627);}function k(_0x40f4dc){return typeof _0x40f4dc=='object'&&!!_0x40f4dc&&!Array['isArray'](_0x40f4dc);}function A(_0x18350f,_0x36d886,_0x3ad5ae){let _0x20485a=_0x18350f['get'](u['IResourceManagerService'])['getAllResourceHooks']()['find'](_0x31d21f=>_0x31d21f['pluginName']===_0x3ad5ae['name']&&_0x31d21f['businesses']['includes'](_0x3ad5ae['business']));if(!_0x20485a)throw new S('INTERNAL_ERROR',_0x3ad5ae['label']+'\x20permission\x20resource\x20is\x20not\x20registered');try{let _0x19e4cc=JSON['parse'](_0x20485a['toJson'](_0x36d886));if(!Array['isArray'](_0x19e4cc)||!_0x19e4cc['every'](_0x33d4cb=>ct(_0x33d4cb,_0x3ad5ae['objectTypes'])))throw Error('Invalid\x20'+_0x3ad5ae['label']+'\x20permission\x20bindings');let _0x39c277=new Set();for(let _0x1342ca of _0x19e4cc){let _0x180d53=_0x1342ca['objectType']+'/'+_0x1342ca['objectId'];if(_0x39c277['has'](_0x180d53))throw Error('Duplicate\x20'+_0x3ad5ae['label']+'\x20permission\x20binding');_0x39c277['add'](_0x180d53);}return _0x19e4cc;}catch(_0x5b7962){throw new S('INTERNAL_ERROR','Failed\x20to\x20read\x20'+_0x3ad5ae['label']+'\x20permission\x20bindings',{'cause':_0x5b7962});}}function ct(_0x304d91,_0x38d0f5){if(!_0x304d91||typeof _0x304d91!='object')return!0x1;let _0x1f5e10=_0x304d91;return typeof _0x1f5e10['objectId']=='string'&&_0x1f5e10['objectId']['length']>0x0&&typeof _0x1f5e10['permissionId']=='string'&&_0x1f5e10['permissionId']['length']>0x0&&_0x1f5e10['objectType']!==void 0x0&&_0x38d0f5['has'](_0x1f5e10['objectType']);}var lt={'name':'BASE_OBJECT_PERMISSION_PLUGIN','business':u['UniverInstanceType']['UNIVER_BASE'],'objectTypes':new Set([c['UnitObject']['BaseTable'],c['UnitObject']['BaseField'],c['UnitObject']['BaseRecord'],c['UnitObject']['BaseView'],c['UnitObject']['BaseDashboard']]),'label':'Base'};function ut(_0x3ac1e2,_0x11e46a){return A(_0x3ac1e2,_0x11e46a,lt);}var dt=new Set(['base-dashboard.mutation.patch-dashboard','base-dashboard.mutation.remove-dashboard','base-dashboard.mutation.set-dashboard']);function ft(_0x7aff0e,_0x2a9c79,_0x2f1f2c){if(_0x2f1f2c['id']['startsWith']('thread-comment.mutation.'))return[{'unitID':_0x2a9c79,'objectID':_0x2a9c79,'objectType':c['UnitObject']['Base'],'action':c['UnitAction']['Comment']}];let _0x2aad6d=_0x2f1f2c['params'],_0x341b85;if(dt['has'](_0x2f1f2c['id'])){let _0xc31780=_0x2aad6d['dashboard'],_0x54f67b=typeof _0x2aad6d['dashboardId']=='string'?_0x2aad6d['dashboardId']:_0xc31780?.['id'];_0x341b85=new Set(typeof _0x54f67b=='string'?[(0x0,p['getBaseDashboardPermissionObjectId'])(_0x54f67b)]:[]);}else{if(_0x2f1f2c['id']['startsWith']('base.mutation.')){let _0xf236fc=_0x7aff0e['get'](u['IUniverInstanceService'])['getUnit'](_0x2a9c79,u['UniverInstanceType']['UNIVER_BASE']);_0x341b85=new Set(tt(_0xf236fc,_0x2aad6d,_0x2f1f2c['id']));}else return[];}return _0x341b85['size']===0x0?[]:E(_0x2a9c79,_0x341b85,ut(_0x7aff0e,_0x2a9c79));}function pt(_0x7fd497,_0x4b74e1){let _0x46d6d4=typeof _0x4b74e1?.['subUnitId']=='string'?_0x4b74e1['subUnitId']:_0x7fd497['getActivePageId'](),_0xb4b40b=_0x7fd497['getSnapshot']()['pages'][_0x46d6d4]?.['elements']??{},_0x3653fd=new Set(mt(_0x4b74e1)),_0x2ff92c=j(_0x4b74e1);return _0x2ff92c['size']&&Object['values'](_0xb4b40b)['forEach'](_0x1a8b5e=>{if(!P(_0x1a8b5e)||typeof _0x1a8b5e['id']!='string')return;let _0x380a9e=_0x1a8b5e;(_0x2ff92c['has'](String(_0x380a9e['chartId']??''))||_0x2ff92c['has'](String(_0x380a9e['tableId']??'')))&&_0x3653fd['add'](_0x380a9e['id']);}),[...ht(_0xb4b40b,_0x3653fd)]['map'](_0x887c2a=>(0x0,ee['getBoardElementPermissionObjectId'])(_0x46d6d4,_0x887c2a));}function mt(_0x43f08f,_0xfe57c7=''){let _0x2a687a=new Set();return N(_0x43f08f,_0xfe57c7,_0x2a687a),[..._0x2a687a];}function j(_0x21247e,_0x3d39e6='',_0x5643e1=new Set()){return P(_0x21247e)?Array['isArray'](_0x21247e)?(_0x21247e['forEach'](_0x17c3c7=>j(_0x17c3c7,_0x3d39e6,_0x5643e1)),_0x5643e1):(Object['entries'](_0x21247e)['forEach'](([_0x2c730c,_0xd623b0])=>{(_0x2c730c==='chartId'||_0x2c730c==='tableId')&&typeof _0xd623b0=='string'&&_0x5643e1['add'](_0xd623b0),_0x2c730c==='id'&&(_0x3d39e6==='chart'||_0x3d39e6==='table')&&typeof _0xd623b0=='string'&&_0x5643e1['add'](_0xd623b0),j(_0xd623b0,_0x2c730c,_0x5643e1);}),_0x5643e1):_0x5643e1;}function ht(_0x257a12,_0x3d10a4){let _0x42a7a6=new Set(_0x3d10a4),_0x599968=Object['values'](_0x257a12)['filter'](P)['filter'](_0x2fac75=>typeof _0x2fac75['id']=='string'),_0x540a4f=_0x263d0e=>{let _0x370ec1=_0x257a12[_0x263d0e];!_0x370ec1||typeof _0x370ec1!='object'||M(_0x370ec1,/^(parentId|groupId|parentNodeId|structureScopeId)$/i)['forEach'](_0x221b4d=>{_0x42a7a6['has'](_0x221b4d)||!_0x257a12[_0x221b4d]||(_0x42a7a6['add'](_0x221b4d),_0x540a4f(_0x221b4d));});};_0x3d10a4['forEach'](_0x540a4f);let _0x432cdf=new Set(_0x3d10a4),_0x2f7205=!0x0;for(;_0x2f7205;)_0x2f7205=!0x1,_0x599968['forEach'](_0x5e642a=>{_0x432cdf['has'](_0x5e642a['id'])||M(_0x5e642a,/(?:parent|group|child|owner|root|start|end|from|to|bound|structureScope).*(?:Id|Ids)$/i)['some'](_0x2077b5=>_0x432cdf['has'](_0x2077b5))&&(_0x432cdf['add'](_0x5e642a['id']),_0x42a7a6['add'](_0x5e642a['id']),_0x2f7205=!0x0);});return _0x42a7a6;}function M(_0x3c435c,_0x2af722,_0x1c94ca='',_0x5a0579=new Set()){return typeof _0x3c435c=='string'?(_0x2af722['test'](_0x1c94ca)&&_0x5a0579['add'](_0x3c435c),[..._0x5a0579]):Array['isArray'](_0x3c435c)?(_0x2af722['test'](_0x1c94ca)?_0x3c435c['forEach'](_0x572f96=>{typeof _0x572f96=='string'&&_0x5a0579['add'](_0x572f96);}):_0x3c435c['forEach'](_0x4031ca=>M(_0x4031ca,_0x2af722,_0x1c94ca,_0x5a0579)),[..._0x5a0579]):(P(_0x3c435c)&&Object['entries'](_0x3c435c)['forEach'](([_0x58c7cc,_0xef574e])=>M(_0xef574e,_0x2af722,_0x58c7cc,_0x5a0579)),[..._0x5a0579]);}function N(_0xbe2b93,_0x56a615,_0x29fd9d){if(typeof _0xbe2b93=='string'){/^(elementId|drawingId|connectorId|containerId|swimlaneId|[a-z]*nodeId)$/i['test'](_0x56a615)&&_0x29fd9d['add'](_0xbe2b93);return;}if(Array['isArray'](_0xbe2b93)){/^(element|drawing|connector|container|swimlane|[a-z]*node)Ids$/i['test'](_0x56a615)?_0xbe2b93['forEach'](_0x44b443=>{typeof _0x44b443=='string'&&_0x29fd9d['add'](_0x44b443);}):_0xbe2b93['forEach'](_0x18b76c=>N(_0x18b76c,_0x56a615,_0x29fd9d));return;}P(_0xbe2b93)&&Object['entries'](_0xbe2b93)['forEach'](([_0x22eda5,_0x56c1df])=>{_0x22eda5==='id'&&(_0x56a615==='element'||_0x56a615==='elements')?typeof _0x56c1df=='string'&&_0x29fd9d['add'](_0x56c1df):N(_0x56c1df,_0x22eda5,_0x29fd9d);});}function P(_0x2220d8){return typeof _0x2220d8=='object'&&!!_0x2220d8&&!Array['isArray'](_0x2220d8);}var gt={'name':'BOARD_OBJECT_PERMISSION_PLUGIN','business':u['UniverInstanceType']['UNIVER_BOARD'],'objectTypes':new Set([c['UnitObject']['BoardElement']]),'label':'Board'};function _t(_0x3473e2,_0x509676){return A(_0x3473e2,_0x509676,gt);}function vt(_0x4906a6,_0x1e94d0,_0x247004){if(_0x247004['id']['startsWith']('thread-comment.mutation.'))return[{'unitID':_0x1e94d0,'objectID':_0x1e94d0,'objectType':c['UnitObject']['Board'],'action':c['UnitAction']['Comment']}];if(!_0x247004['id']['startsWith']('board.mutation.'))return[];let _0x4229ec=_0x247004['params'];if(_0x247004['id']==='board.mutation.update-element'&&_0x4229ec['formulaLastValueGuard'])return[];let _0x4c0e44=_0x4906a6['get'](u['IUniverInstanceService'])['getUnit'](_0x1e94d0,u['UniverInstanceType']['UNIVER_BOARD']),_0x1c6798=new Set(pt(_0x4c0e44,_0x4229ec));return _0x1c6798['size']===0x0?[]:E(_0x1e94d0,_0x1c6798,_t(_0x4906a6,_0x1e94d0));}var yt=['defaultHeaderId','defaultFooterId','firstPageHeaderId','firstPageFooterId','evenPageHeaderId','evenPageFooterId'],bt=new WeakMap();function F(_0x4afa6e){let _0x20be01=_0x4afa6e['getMutationRevision']?.()??NaN,_0x177a38=bt['get'](_0x4afa6e);if(_0x177a38?.['mutationRevision']===_0x20be01)return _0x177a38;let _0x3c11f5=_0x4afa6e['getSnapshot'](),_0x40e956=_0x3c11f5['body']?(0x0,m['getTopLevelSectionBreaks'])(_0x3c11f5['body']):[],_0x45d472=new Map(),_0x360f9c=(_0x121235,_0x17c059)=>{for(let _0x580742 of _0x121235?.['customBlocks']??[])_0x45d472['has'](_0x580742['blockId'])||_0x45d472['set'](_0x580742['blockId'],_0x17c059);};_0x360f9c(_0x3c11f5['body'],''),Object['entries'](_0x3c11f5['headers']??{})['forEach'](([_0x511a49,_0x341e02])=>_0x360f9c(_0x341e02['body'],_0x511a49)),Object['entries'](_0x3c11f5['footers']??{})['forEach'](([_0x6638f5,_0x35bd81])=>_0x360f9c(_0x35bd81['body'],_0x6638f5)),Object['entries'](_0x3c11f5['notes']??{})['forEach'](([_0x28e363,_0x1ee8ac])=>_0x360f9c(_0x1ee8ac['body'],_0x28e363));let _0x5329a5=new Map();for(let _0x16b399 of _0x3c11f5['body']?.['customRanges']??[])(_0x16b399['rangeType']===u['CustomRangeType']['FOOTNOTE']||_0x16b399['rangeType']===u['CustomRangeType']['ENDNOTE'])&&typeof _0x16b399['properties']?.['noteId']=='string'&&_0x5329a5['set'](_0x16b399['properties']['noteId'],{'startOffset':_0x16b399['startIndex'],'endOffset':_0x16b399['endIndex']+0x1});let _0x55b632={'drawingSegmentIds':_0x45d472,'footnoteReferenceRanges':_0x5329a5,'mutationRevision':_0x20be01,'segments':new Map(),'topLevelSections':_0x40e956};return bt['set'](_0x4afa6e,_0x55b632),_0x55b632;}function xt(_0x48206c,_0x1c4043,_0x1330c1=F(_0x48206c)){let _0x349a3c=_0x1330c1['segments']['get'](_0x1c4043);if(_0x349a3c)return _0x349a3c;let _0x4d303d=_0x48206c['getSelfOrHeaderFooterModel'](_0x1c4043)?.['getBody']()??null,_0x506b7f=_0x48206c['getSnapshot'](),_0x208ca7=_0x506b7f['notes']?.[_0x1c4043],_0x319472=(_0x208ca7?_0x208ca7['drawings']:_0x506b7f['drawings'])??{},_0x273618=_0x4d303d==null?[]:[...(_0x4d303d['tables']??[])['map'](_0x43ba28=>({'type':'table','id':_0x43ba28['tableId'],'startOffset':_0x43ba28['startIndex'],'endOffset':_0x43ba28['endIndex']})),...(_0x4d303d['customBlocks']??[])['map'](_0x23d7c6=>({'type':_0x319472[_0x23d7c6['blockId']]?'drawing':'custom-block','id':_0x23d7c6['blockId'],'startOffset':_0x23d7c6['startIndex'],'endOffset':_0x23d7c6['startIndex']+0x1})),...(_0x4d303d['blockRanges']??[])['map'](_0x16c1ae=>({'type':'block-range','id':_0x16c1ae['blockId'],'startOffset':_0x16c1ae['startIndex'],'endOffset':_0x16c1ae['endIndex']+0x1})),...(_0x4d303d['customRanges']??[])['map'](_0x2a07bc=>({'type':'custom-range','id':_0x2a07bc['rangeId'],'startOffset':_0x2a07bc['startIndex'],'endOffset':_0x2a07bc['endIndex']+0x1})),...(_0x4d303d['columnGroups']??[])['map'](_0xb40c6d=>({'type':'column-group','id':_0xb40c6d['columnGroupId'],'startOffset':_0xb40c6d['startIndex'],'endOffset':_0xb40c6d['endIndex']+0x1}))],_0x3ff0ec=new Map(_0x273618['map'](_0x1478a4=>[_0x1478a4['type']+':'+_0x1478a4['id'],{'startOffset':_0x1478a4['startOffset'],'endOffset':_0x1478a4['endOffset']}]));for(let _0x12389a of _0x4d303d?.['customBlocks']??[]){let _0x280fb4={'startOffset':_0x12389a['startIndex'],'endOffset':_0x12389a['startIndex']+0x1};_0x3ff0ec['set']('custom-block:'+_0x12389a['blockId'],_0x280fb4),_0x3ff0ec['set']('drawing:'+_0x12389a['blockId'],_0x280fb4);}let _0x4dd31e={'body':_0x4d303d,'entities':_0x273618,'entityRanges':_0x3ff0ec,'paragraphContentStartOffsets':_0x4d303d==null?new Map():(0x0,u['getParagraphContentStartOffsets'])(_0x4d303d),'paragraphsById':new Map((_0x4d303d?.['paragraphs']??[])['filter'](_0x1d23bd=>_0x1d23bd['paragraphId']!=null)['map'](_0x4daf00=>[_0x4daf00['paragraphId'],_0x4daf00]))};return _0x1330c1['segments']['set'](_0x1c4043,_0x4dd31e),_0x4dd31e;}function St(_0x129c5f,_0x248b1d){return F(_0x129c5f)['drawingSegmentIds']['get'](_0x248b1d)??'';}function Ct(_0x40ef7a,_0x226ebe,_0x38a091){let _0x203ba1=F(_0x40ef7a),_0x134157=xt(_0x40ef7a,_0x226ebe,_0x203ba1),{body:_0x123c5f}=_0x134157;return _0x123c5f?[...L(_0x40ef7a,_0x226ebe,_0x38a091,_0x203ba1),...Ot(_0x123c5f,_0x226ebe,_0x38a091,_0x134157),...kt(_0x226ebe,_0x38a091,_0x134157)]:[];}function wt(_0x4b3dce,_0x4f56f4,_0x5cadcb){let _0x53b64b=new Set();if(_0x5cadcb==null)return[];let _0x2e509f=u['JSON1']['type']['readCursor'](_0x5cadcb);return _0x2e509f['traverse'](null,()=>{let _0x539b49=_0x2e509f['getPath'](),_0x53e4e6=_0x2e509f['getComponent'](),_0x1db8ff=['headers','footers','notes']['includes'](String(_0x539b49[0x0]))&&typeof _0x539b49[0x1]=='string'?_0x539b49[0x1]:_0x4f56f4;if(_0x539b49[0x0]==='notes'&&typeof _0x539b49[0x1]=='string'&&L(_0x4b3dce,_0x539b49[0x1],{'startOffset':0x0,'endOffset':0x0})['forEach'](_0x301566=>_0x53b64b['add'](_0x301566)),_0x539b49[0x0]==='noteSettings'&&F(_0x4b3dce)['topLevelSections']['forEach'](_0x385d9b=>{_0x53b64b['add']((0x0,m['getDocumentSectionPermissionObjectId'])('',_0x385d9b['sectionId']));}),_0x539b49[0x0]==='body'&&_0x539b49[0x1]==='sectionBreaks'&&typeof _0x539b49[0x2]=='number'&&(_0x539b49[0x3]==='noteProperties'||_0x539b49[0x3]==='suppressEndnotes')){let _0x27e428=_0x4b3dce['getBody']()?.['sectionBreaks']?.[_0x539b49[0x2]]?.['sectionId'];_0x27e428&&_0x53b64b['add']((0x0,m['getDocumentSectionPermissionObjectId'])('',_0x27e428));}if(_0x539b49[_0x539b49['length']-0x1]!=='body'||_0x53e4e6?.['et']!==u['TextX']['id']||!Array['isArray'](_0x53e4e6['e'])||!_0x53e4e6['e']['every'](Et))return;let _0x140eea=_0x53e4e6['e'],_0x349c9b=0x0,_0x5d7f89=(_0x1b9a09,_0x519c65)=>{Ct(_0x4b3dce,_0x1db8ff,{'startOffset':_0x1b9a09,'endOffset':_0x519c65})['forEach'](_0x2c5236=>_0x53b64b['add'](_0x2c5236));};_0x140eea['forEach'](_0x20757a=>{if(_0x20757a['t']===u['TextXActionType']['INSERT']){_0x5d7f89(_0x349c9b,_0x349c9b);return;}if(_0x20757a['t']===u['TextXActionType']['DELETE']){_0x5d7f89(_0x349c9b,_0x349c9b+_0x20757a['len']),_0x349c9b+=_0x20757a['len'];return;}(_0x20757a['body']!==void 0x0||_0x20757a['oldBody']!==void 0x0||_0x20757a['coverType']!==void 0x0)&&_0x5d7f89(_0x349c9b,_0x349c9b+_0x20757a['len']),_0x349c9b+=_0x20757a['len'];});}),Tt(_0x5cadcb)['forEach'](_0x364697=>{_0x53b64b['add']((0x0,m['getDocumentEntityPermissionObjectId'])(_0x4f56f4,'drawing',_0x364697));let _0x2057d5=(_0x4b3dce['getSelfOrHeaderFooterModel'](_0x4f56f4)?.['getBody']())?.['customBlocks']?.['find'](_0x5ebe1e=>_0x5ebe1e['blockId']===_0x364697);_0x2057d5&&L(_0x4b3dce,_0x4f56f4,{'startOffset':_0x2057d5['startIndex'],'endOffset':_0x2057d5['startIndex']+0x1})['forEach'](_0x253ed5=>_0x53b64b['add'](_0x253ed5));}),[..._0x53b64b];}function Tt(_0x1d3cc3){let _0x49fff0=new Set(),_0x43fb08=_0x4e9672=>{if(Array['isArray'](_0x4e9672)){_0x4e9672['forEach']((_0x5cc7e7,_0x17c827)=>{_0x5cc7e7==='drawings'&&typeof _0x4e9672[_0x17c827+0x1]=='string'&&_0x49fff0['add'](_0x4e9672[_0x17c827+0x1]),_0x43fb08(_0x5cc7e7);});return;}I(_0x4e9672)&&Object['values'](_0x4e9672)['forEach'](_0x43fb08);};return _0x43fb08(_0x1d3cc3),[..._0x49fff0];}function Et(_0x5965e2){return!I(_0x5965e2)||typeof _0x5965e2['len']!='number'?!0x1:_0x5965e2['t']===u['TextXActionType']['INSERT']?I(_0x5965e2['body']):_0x5965e2['t']===u['TextXActionType']['RETAIN']||_0x5965e2['t']===u['TextXActionType']['DELETE'];}function I(_0x48662f){return typeof _0x48662f=='object'&&!!_0x48662f&&!Array['isArray'](_0x48662f);}function Dt(_0x564a73,_0xbf0bf3,_0x45a6ed,_0x484a29){let _0x5cda96=F(_0x564a73),_0x45db0d=xt(_0x564a73,_0xbf0bf3,_0x5cda96)['entityRanges']['get'](_0x45a6ed+':'+_0x484a29)??null;return _0x45db0d?L(_0x564a73,_0xbf0bf3,_0x45db0d,_0x5cda96):[];}function L(_0x86823d,_0xcd6a14,_0x2e8579,_0x26bcf4=F(_0x86823d)){if(_0xcd6a14){let _0x371b2f=_0x26bcf4['footnoteReferenceRanges']['get'](_0xcd6a14);return _0x371b2f?Ct(_0x86823d,'',_0x371b2f):jt(_0x86823d,_0xcd6a14,_0x26bcf4['topLevelSections'])['map'](_0x41d13f=>(0x0,m['getDocumentSectionPermissionObjectId'])('',_0x41d13f));}return At(_0x26bcf4['topLevelSections'],_0x2e8579)['map'](_0x4e87a5=>(0x0,m['getDocumentSectionPermissionObjectId'])('',_0x4e87a5['sectionId']));}function Ot(_0x533106,_0x42029b,_0x2f0345,_0x4a9e61){let _0x36d6da=Math['min'](_0x2f0345['startOffset'],_0x2f0345['endOffset']),_0x268278=Math['max'](_0x2f0345['startOffset'],_0x2f0345['endOffset']);return(_0x533106['paragraphs']??[])['filter'](_0x4d1d61=>R(_0x4a9e61['paragraphContentStartOffsets']['get'](_0x4d1d61['startIndex'])??(0x0,u['getParagraphContentStartOffset'])(_0x533106,_0x4d1d61),_0x4d1d61['startIndex']+0x1,_0x36d6da,_0x268278))['flatMap'](_0x4f52d1=>_0x4f52d1['paragraphId']?[(0x0,m['getDocumentParagraphPermissionObjectId'])(_0x42029b,_0x4f52d1['paragraphId'])]:[]);}function kt(_0x522df8,_0x3f7c74,_0x1db169){let _0x57d562=Math['min'](_0x3f7c74['startOffset'],_0x3f7c74['endOffset']),_0x55c737=Math['max'](_0x3f7c74['startOffset'],_0x3f7c74['endOffset']);return _0x1db169['entities']['filter'](_0x279256=>R(_0x279256['startOffset'],_0x279256['endOffset'],_0x57d562,_0x55c737))['map'](_0x5d4993=>(0x0,m['getDocumentEntityPermissionObjectId'])(_0x522df8,_0x5d4993['type'],_0x5d4993['id']));}function At(_0x33d1ff,_0x1b0efd){let _0x3532ac=Math['min'](_0x1b0efd['startOffset'],_0x1b0efd['endOffset']),_0x40cd6a=Math['max'](_0x1b0efd['startOffset'],_0x1b0efd['endOffset']);return _0x33d1ff['filter']((_0x4d7bd5,_0x5b7c4d)=>R(_0x5b7c4d===0x0?0x0:_0x33d1ff[_0x5b7c4d-0x1]['startIndex']+0x1,_0x4d7bd5['startIndex']+0x1,_0x3532ac,_0x40cd6a));}function R(_0x8afe6,_0x5e7543,_0x21b29f,_0x9cbbf5){return _0x21b29f===_0x9cbbf5?_0x21b29f>=_0x8afe6&&_0x21b29f<_0x5e7543:_0x21b29f<_0x5e7543&&_0x9cbbf5>_0x8afe6;}function jt(_0x27c5d0,_0x4de69b,_0x16f4ea=F(_0x27c5d0)['topLevelSections']){let _0x4b426d=_0x27c5d0['getSnapshot'](),_0x21a33e=new Set();return _0x16f4ea['forEach']((_0x62870,_0x1ac595)=>{yt['some'](_0x1435c3=>(0x0,u['resolveSectionHeaderFooterReference'])(_0x4b426d['documentStyle'],_0x16f4ea,_0x1ac595,_0x1435c3)['segmentId']===_0x4de69b)&&_0x21a33e['add'](_0x62870['sectionId']);}),[..._0x21a33e];}function Mt(_0x12e36d,_0x593752){let _0x58531d=z(_0x593752['params'])?_0x593752['params']:void 0x0;if(_0x593752['id']===m['RichTextEditingMutation']['id']){let _0x41427e=_0x593752['params'];return wt(_0x12e36d,_0x41427e['segmentId']??'',_0x41427e['actions']);}return _0x593752['id']==='doc.mutation.rename-doc'||_0x593752['id']==='docs-formula.mutation.set-last-values'||_0x593752['id']==='doc.mutation.update-shape-data'&&_0x58531d?.['formulaLastValueGuard']?[]:Nt(_0x12e36d,_0x593752);}function Nt(_0x1ad72e,_0x1d103d){let _0x2d4025=_0x1d103d['params'];if(!z(_0x2d4025))return[];let _0x3a9431=new Set(),_0x27d636=(_0x324c85,_0x39f5fb,_0x2d359b)=>{_0x3a9431['add']((0x0,m['getDocumentEntityPermissionObjectId'])(_0x324c85,_0x39f5fb,_0x2d359b)),Dt(_0x1ad72e,_0x324c85,_0x39f5fb,_0x2d359b)['forEach'](_0x397029=>_0x3a9431['add'](_0x397029));};return Pt(_0x2d4025)['forEach'](({entityType:_0x553a0a,entityId:_0x432059})=>{let _0x5da405=_0x2d4025['segmentId'],_0x31fc34=typeof _0x5da405=='string'?_0x5da405:_0x553a0a==='drawing'||_0x553a0a==='custom-block'?St(_0x1ad72e,_0x432059):'';_0x27d636(_0x31fc34,_0x553a0a,_0x432059);}),[..._0x3a9431];}function Pt(_0x1e8a65){let _0x7e3a47=new Map(),_0x25c99b={'blockId':['custom-block'],'drawingId':['drawing'],'shapeId':['drawing','custom-block'],'tableId':['table'],'rangeId':['custom-range'],'columnGroupId':['column-group']},_0x2b1429=(_0x4793f3,_0x5367b3='')=>{if(typeof _0x4793f3=='string'){_0x25c99b[_0x5367b3]?.['forEach'](_0x1a1516=>{_0x7e3a47['set'](_0x1a1516+'\x1f'+_0x4793f3,{'entityType':_0x1a1516,'entityId':_0x4793f3});});return;}if(Array['isArray'](_0x4793f3)){let _0x5220c4=_0x5367b3['endsWith']('Ids')?_0x5367b3['slice'](0x0,-0x3)+'Id':_0x5367b3;_0x4793f3['forEach'](_0x1ddbaf=>_0x2b1429(_0x1ddbaf,_0x5220c4));return;}z(_0x4793f3)&&Object['entries'](_0x4793f3)['forEach'](([_0x1e61a9,_0x504187])=>_0x2b1429(_0x504187,_0x1e61a9));};return _0x2b1429(_0x1e8a65),[..._0x7e3a47['values']()];}function z(_0x4304b3){return typeof _0x4304b3=='object'&&!!_0x4304b3&&!Array['isArray'](_0x4304b3);}var Ft={'name':'DOC_OBJECT_PERMISSION_PLUGIN','business':u['UniverInstanceType']['UNIVER_DOC'],'objectTypes':new Set([c['UnitObject']['DocumentSection'],c['UnitObject']['DocumentParagraph'],c['UnitObject']['DocumentEntity']]),'label':'Document'};function It(_0x35027c,_0x1871b1){return A(_0x35027c,_0x1871b1,Ft);}function Lt(_0xd4198f,_0x51bae5,_0x234b05){if(_0x234b05['id']['startsWith']('thread-comment.mutation.'))return[{'unitID':_0x51bae5,'objectID':_0x51bae5,'objectType':c['UnitObject']['Document'],'action':c['UnitAction']['Comment']}];let _0x1bd863=_0xd4198f['get'](u['IUniverInstanceService'])['getUnit'](_0x51bae5,u['UniverInstanceType']['UNIVER_DOC']),_0x40f337=new Set(Mt(_0x1bd863,_0x234b05));return _0x40f337['size']===0x0?[]:E(_0x51bae5,_0x40f337,It(_0xd4198f,_0x51bae5));}function Rt(_0x3464e7){let {startRow:_0x20b505,startColumn:_0x3d88e6,endRow:_0x4ac16b,endColumn:_0x125150,rangeType:_0x1c8bcb}=_0x3464e7;return(Number['isNaN'](_0x20b505)||[u['RANGE_TYPE']['ALL'],u['RANGE_TYPE']['COLUMN']]['includes'](_0x1c8bcb))&&(_0x3464e7['startRow']=0x0),(Number['isNaN'](_0x4ac16b)||[u['RANGE_TYPE']['ALL'],u['RANGE_TYPE']['COLUMN']]['includes'](_0x1c8bcb))&&(_0x3464e7['endRow']=u['MAX_ROW_COUNT']-0x1),(Number['isNaN'](_0x3d88e6)||[u['RANGE_TYPE']['ALL'],u['RANGE_TYPE']['ROW']]['includes'](_0x1c8bcb))&&(_0x3464e7['startColumn']=0x0),(Number['isNaN'](_0x125150)||[u['RANGE_TYPE']['ALL'],u['RANGE_TYPE']['ROW']]['includes'](_0x1c8bcb))&&(_0x3464e7['endColumn']=u['MAX_COLUMN_COUNT']-0x1),_0x3464e7;}function zt(_0x4bf205,_0x349bae){return[new h['WorkbookEditablePermission'](_0x4bf205),new h['WorksheetEditPermission'](_0x4bf205,_0x349bae)];}function B(_0x5b456d,_0x223193){return _0x5b456d['get'](u['IUniverInstanceService'])['getUnitType'](_0x223193)===u['UniverInstanceType']['UNIVER_SHEET'];}function V(_0x30effc,_0x429c9d,_0x2cb30c,_0x1338a1,_0x4bd312){let _0x1a870d=[];_0x4bd312['workbookTypes']?.['forEach'](_0x4e7b51=>{_0x1a870d['push'](new _0x4e7b51(_0x429c9d));}),_0x4bd312['worksheetTypes']?.['forEach'](_0x4c67b8=>{_0x1a870d['push'](new _0x4c67b8(_0x429c9d,_0x2cb30c));});let _0x7936f2=_0x1338a1['map'](_0x1d63b4=>Rt({..._0x1d63b4})),_0x532f72=_0x30effc['get'](h['RangeProtectionRuleModel'])['getSubunitRuleList'](_0x429c9d,_0x2cb30c)['filter'](_0x3ca566=>_0x3ca566['ranges']['some'](_0x15ec51=>_0x7936f2['some'](_0x34b2c3=>u['Rectangle']['intersects'](_0x15ec51,_0x34b2c3))));return _0x4bd312['rangeTypes']?.['forEach'](_0x3fe4a2=>{_0x532f72['forEach'](_0x153113=>{_0x1a870d['push'](new _0x3fe4a2(_0x429c9d,_0x2cb30c,_0x153113['permissionId']));});}),_0x1a870d;}function H(_0xabe3d4,_0x2f0f7d){return _0x2f0f7d['map'](_0x5157f1=>new _0x5157f1(_0xabe3d4));}var Bt=[{'id':g['AddConditionalRuleMutation']['id'],'handle'(_0x41a54e,_0x9baa7d){let {params:_0x36197d}=_0x9baa7d;return V(_0x41a54e,_0x36197d['unitId'],_0x36197d['subUnitId'],_0x36197d['rule']['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':_['AddDataValidationMutation']['id'],'handle'(_0x4af320,_0x451ca2){let {unitId:_0x2bd1d7,subUnitId:_0x433b8a}=_0x451ca2['params'];if(!B(_0x4af320,_0x2bd1d7))return[];let _0x2d1434=[];return Array['isArray'](_0x451ca2['params']['rule'])?_0x451ca2['params']['rule']['forEach'](_0x3cb30f=>{_0x2d1434['push'](..._0x3cb30f['ranges']);}):_0x2d1434['push'](..._0x451ca2['params']['rule']['ranges']),V(_0x4af320,_0x2bd1d7,_0x433b8a,_0x2d1434,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['AddRangeProtectionMutation']['id'],'handle'(_0x307af1,_0x12e199){let {params:_0x1fb946}=_0x12e199,{unitId:_0x2ddeb3}=_0x1fb946;return[new h['WorkbookCreateProtectPermission'](_0x2ddeb3)];}},{'id':h['AddWorksheetMergeMutation']['id'],'handle'(_0x11d4a5,_0x3cc2e8){let {params:_0x19ee94}=_0x3cc2e8;return V(_0x11d4a5,_0x19ee94['unitId'],_0x19ee94['subUnitId'],_0x19ee94['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission'],h['WorksheetSetCellValuePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':g['DeleteConditionalRuleMutation']['id'],'handle'(_0x4e0cb6,_0x8c306a){let {params:_0x17912b}=_0x8c306a,_0xca169c=_0x4e0cb6['get'](g['ConditionalFormattingRuleModel'])['getRule'](_0x17912b['unitId'],_0x17912b['subUnitId'],_0x17912b['cfId']);return _0xca169c?V(_0x4e0cb6,_0x17912b['unitId'],_0x17912b['subUnitId'],_0xca169c['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]}):[];}},{'id':h['DeleteRangeProtectionMutation']['id'],'handle'(_0x4aa11b,_0x43fed7){let {params:_0x3dde01}=_0x43fed7,{unitId:_0x59069f,subUnitId:_0x3708ea,ruleIds:_0x5bcfe9}=_0x3dde01,_0x4dbdb3=_0x4aa11b['get'](h['RangeProtectionRuleModel']),_0x53f746=[];for(let _0x198b09 of _0x5bcfe9){let _0x3944f2=_0x4dbdb3['getRule'](_0x59069f,_0x3708ea,_0x198b09);if(!_0x3944f2)return!0x1;_0x53f746['push'](new h['RangeProtectionPermissionDeleteProtectionPoint'](_0x59069f,_0x3708ea,_0x3944f2['permissionId']));}return _0x53f746;}},{'id':h['DeleteWorksheetProtectionMutation']['id'],'handle'(_0x277e9f,_0x2aad6c){let {params:_0x6b010f}=_0x2aad6c,{unitId:_0x213b5d,subUnitId:_0x3732ec}=_0x6b010f;return[new h['WorksheetDeleteProtectionPermission'](_0x213b5d,_0x3732ec)];}},{'id':h['ToggleGridlinesMutation']['id'],'handle'(_0x5a82c6,_0x6dd6ad){let {params:_0x1b0321}=_0x6dd6ad;return[new h['WorkbookEditablePermission'](_0x1b0321['unitId']),new h['WorksheetEditPermission'](_0x1b0321['unitId'],_0x1b0321['subUnitId'])];}},{'id':h['InsertColMutation']['id'],'handle'(_0x12d1aa,_0x1bc970){let {params:_0x1d0d21}=_0x1bc970,_0x1bb58d={..._0x1d0d21['range']};return _0x1bb58d['rangeType']=u['RANGE_TYPE']['COLUMN'],V(_0x12d1aa,_0x1d0d21['unitId'],_0x1d0d21['subUnitId'],[_0x1bb58d],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetInsertColumnPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['InsertRowMutation']['id'],'handle'(_0x5b8ab4,_0x52e481){let {params:_0x28e46e}=_0x52e481,_0x522c00={..._0x28e46e['range']};return _0x522c00['rangeType']=u['RANGE_TYPE']['ROW'],V(_0x5b8ab4,_0x28e46e['unitId'],_0x28e46e['subUnitId'],[_0x522c00],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetInsertRowPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['InsertSheetMutation']['id'],'handle'(_0x26fde9,_0x2e0788){let {params:_0x434a7b}=_0x2e0788;return H(_0x434a7b['unitId'],[h['WorkbookCreateSheetPermission']]);}},{'id':h['MoveColsMutation']['id'],'handle'(_0x4469b4,_0x36cc30){let {params:_0x357ce0}=_0x36cc30,_0x118869={..._0x357ce0['sourceRange']};_0x118869['rangeType']=u['RANGE_TYPE']['COLUMN'];let _0xe6851a={..._0x357ce0['targetRange']};return _0xe6851a['rangeType']=u['RANGE_TYPE']['COLUMN'],V(_0x4469b4,_0x357ce0['unitId'],_0x357ce0['subUnitId'],[_0x118869,_0xe6851a],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':g['MoveConditionalRuleMutation']['id'],'handle'(_0x325294,_0x271a8b){let {params:_0x1f9df}=_0x271a8b;return zt(_0x1f9df['unitId'],_0x1f9df['subUnitId']);}},{'id':h['MoveRangeMutation']['id'],'handle'(_0x25ffa,_0x150098){let {params:_0x28066c}=_0x150098,_0x5914cd=new u['ObjectMatrix'](_0x28066c['from']['value'])['getDataRange'](),_0x50c859=new u['ObjectMatrix'](_0x28066c['to']['value'])['getDataRange']();return V(_0x25ffa,_0x28066c['unitId'],_0x28066c['from']['subUnitId'],[_0x5914cd,_0x50c859],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['MoveRowsMutation']['id'],'handle'(_0x143c1b,_0x96a2c0){let {params:_0x306f00}=_0x96a2c0,_0x11d7b4={..._0x306f00['sourceRange']};_0x11d7b4['rangeType']=u['RANGE_TYPE']['ROW'];let _0x4cb9ca={..._0x306f00['targetRange']};return _0x4cb9ca['rangeType']=u['RANGE_TYPE']['ROW'],V(_0x143c1b,_0x306f00['unitId'],_0x306f00['subUnitId'],[_0x11d7b4,_0x4cb9ca],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveColMutation']['id'],'handle'(_0x93443e,_0x59cc58){let {params:_0x409080}=_0x59cc58,_0x55e2b5={..._0x409080['range']};return _0x55e2b5['rangeType']=u['RANGE_TYPE']['COLUMN'],V(_0x93443e,_0x409080['unitId'],_0x409080['subUnitId'],[_0x55e2b5],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetDeleteColumnPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':_['RemoveDataValidationMutation']['id'],'handle'(_0x223dc6,_0x1a7043){let {unitId:_0x3fc5c0,subUnitId:_0x39566,ruleId:_0x100416}=_0x1a7043['params'];if(!B(_0x223dc6,_0x3fc5c0))return[];let _0x4c63e9=_0x223dc6['get'](_['DataValidationModel']),_0x587c7e=(Array['isArray'](_0x100416)?_0x100416:[_0x100416])['map'](_0xfbae86=>_0x4c63e9['getRuleById'](_0x3fc5c0,_0x39566,_0xfbae86)),_0x1ba249=[];return _0x587c7e['forEach'](_0x3bf5d0=>{_0x3bf5d0?.['ranges']&&_0x1ba249['push'](..._0x3bf5d0['ranges']);}),V(_0x223dc6,_0x3fc5c0,_0x39566,_0x1ba249,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveNumfmtMutation']['id'],'handle'(_0x2be8db,_0x106b0f){let {params:_0x5ad17f}=_0x106b0f,{ranges:_0x11d4f3}=_0x5ad17f;return V(_0x2be8db,_0x5ad17f['unitId'],_0x5ad17f['subUnitId'],_0x11d4f3,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveRowMutation']['id'],'handle'(_0x1d6df7,_0x2f79c4){let {params:_0x463190}=_0x2f79c4,_0x5b8b0={..._0x463190['range']};return _0x5b8b0['rangeType']=u['RANGE_TYPE']['ROW'],V(_0x1d6df7,_0x463190['unitId'],_0x463190['subUnitId'],[_0x5b8b0],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetDeleteRowPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveSheetMutation']['id'],'handle'(_0x2458c0,_0x2d2194){let {params:_0x39f753}=_0x2d2194;return H(_0x39f753['unitId'],[h['WorkbookDeleteSheetPermission']]);}},{'id':te['RemoveSheetsFilterMutation']['id'],'handle'(_0x32ad2e,_0x2428a3){let {params:_0x31c135}=_0x2428a3;return V(_0x32ad2e,_0x31c135['unitId'],_0x31c135['subUnitId'],[],{'worksheetTypes':[h['WorksheetViewPermission']],'rangeTypes':[h['RangeProtectionPermissionViewPoint']]});}},{'id':h['RemoveWorksheetMergeMutation']['id'],'handle'(_0x51cb56,_0x48e145){let {params:_0x4b1509}=_0x48e145;return V(_0x51cb56,_0x4b1509['unitId'],_0x4b1509['subUnitId'],_0x4b1509['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission'],h['WorksheetSetCellValuePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['ReorderRangeMutation']['id'],'handle'(_0x4bf71d,_0x3980a9){let {params:_0x141647}=_0x3980a9,{range:_0x442fb8}=_0x141647;return V(_0x4bf71d,_0x141647['unitId'],_0x141647['subUnitId'],[_0x442fb8],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetSortPermission'],h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['SetWorksheetColWidthMutation']['id'],'handle'(_0x489691,_0x52c340){let {params:_0x39bd5b}=_0x52c340,_0x63e641=[..._0x39bd5b['ranges']]['map'](_0x59a530=>{let _0x453526={..._0x59a530};return _0x453526['rangeType']=u['RANGE_TYPE']['COLUMN'],_0x453526;});return V(_0x489691,_0x39bd5b['unitId'],_0x39bd5b['subUnitId'],_0x63e641,{'worksheetTypes':[h['WorksheetSetColumnStylePermission']]});}},{'id':g['SetConditionalRuleMutation']['id'],'handle'(_0x1173f6,_0xfbd391){let {params:_0x17c3c5}=_0xfbd391,_0x384d75=_0x1173f6['get'](g['ConditionalFormattingRuleModel'])['getRule'](_0x17c3c5['unitId'],_0x17c3c5['subUnitId'],_0x17c3c5['cfId']||_0x17c3c5['rule']['cfId']);return[..._0x384d75?V(_0x1173f6,_0x17c3c5['unitId'],_0x17c3c5['subUnitId'],_0x384d75['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]}):[],...V(_0x1173f6,_0x17c3c5['unitId'],_0x17c3c5['subUnitId'],_0x17c3c5['rule']['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]})];}},{'id':h['SetNumfmtMutation']['id'],'handle'(_0x134b07,_0x511ade){let {params:_0x51c4cc}=_0x511ade,{values:_0x3a563c}=_0x51c4cc,_0x305b5b=[];return Object['keys'](_0x3a563c)['forEach'](_0x92d681=>{let _0x11c780=_0x3a563c[_0x92d681];_0x305b5b['push'](..._0x11c780['ranges']);}),V(_0x134b07,_0x51c4cc['unitId'],_0x51c4cc['subUnitId'],_0x305b5b,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['SetRangeProtectionMutation']['id'],'handle'(_0xf5f622,_0x42ecac){let {params:_0x23e06d}=_0x42ecac,{unitId:_0xb5e6c4,subUnitId:_0x468337,ruleId:_0x302028}=_0x23e06d,_0x3f09d7=_0xf5f622['get'](h['RangeProtectionRuleModel'])['getRule'](_0xb5e6c4,_0x468337,_0x302028);return _0x3f09d7?[new h['RangeProtectionPermissionManageCollaPoint'](_0xb5e6c4,_0x468337,_0x3f09d7['permissionId'])]:[];}},{'id':h['SetRangeValuesMutation']['id'],'handle'(_0x56ef7c,_0x3a4b04){let {params:_0x2aba4d}=_0x3a4b04,_0xbc8465=new u['ObjectMatrix'](_0x2aba4d['cellValue']),_0x3c72bc=[new h['WorkbookEditablePermission'](_0x2aba4d['unitId']),new h['WorksheetEditPermission'](_0x2aba4d['unitId'],_0x2aba4d['subUnitId'])],_0x305725=_0x56ef7c['get'](h['RangeProtectionRuleModel'])['getSubunitRuleList'](_0x2aba4d['unitId'],_0x2aba4d['subUnitId']);return _0xbc8465['forValue']((_0x311c7a,_0x4fe033)=>{_0x305725['filter'](_0x8093a=>_0x8093a['ranges']['some'](_0x3fb1c4=>_0x311c7a>=_0x3fb1c4['startRow']&&_0x311c7a<=_0x3fb1c4['endRow']&&_0x4fe033>=_0x3fb1c4['startColumn']&&_0x4fe033<=_0x3fb1c4['endColumn']))['forEach'](_0x5a2b83=>{_0x3c72bc['push'](new h['RangeProtectionPermissionEditPoint'](_0x2aba4d['unitId'],_0x2aba4d['subUnitId'],_0x5a2b83['permissionId']));});}),_0x3c72bc;}},{'id':h['SetWorksheetRowAutoHeightMutation']['id'],'handle'(_0x1bec48,_0x45acdb){let {params:_0x394fb6}=_0x45acdb,_0x43dc31=_0x394fb6['rowsAutoHeightInfo']['map'](_0x19abe0=>{let _0x411cf3={'startColumn':0x0,'endColumn':0x0,'startRow':_0x19abe0['row'],'endRow':_0x19abe0['row']};return _0x411cf3['rangeType']=u['RANGE_TYPE']['ROW'],_0x411cf3;});return V(_0x1bec48,_0x394fb6['unitId'],_0x394fb6['subUnitId'],_0x43dc31,{'worksheetTypes':[h['WorksheetSetRowStylePermission']]});}},{'id':h['SetWorksheetRowHeightMutation']['id'],'handle'(_0x3ca6a5,_0x5d5e6a){let {params:_0x14eb33}=_0x5d5e6a,_0x4aa50f=[..._0x14eb33['ranges']]['map'](_0x399c78=>{let _0x3aed3a={..._0x399c78};return _0x3aed3a['rangeType']=u['RANGE_TYPE']['ROW'],_0x3aed3a;});return V(_0x3ca6a5,_0x14eb33['unitId'],_0x14eb33['subUnitId'],_0x4aa50f,{'worksheetTypes':[h['WorksheetSetRowStylePermission']]});}},{'id':h['SetWorksheetHideMutation']['id'],'handle'(_0x3761bf,_0x3ce7bf){let {params:_0x472bec}=_0x3ce7bf;return H(_0x472bec['unitId'],[h['WorkbookHideSheetPermission']]);}},{'id':h['SetWorksheetNameMutation']['id'],'handle'(_0x4375cd,_0x3ff156){let {params:_0x550215}=_0x3ff156;return H(_0x550215['unitId'],[h['WorkbookRenameSheetPermission']]);}},{'id':h['SetWorksheetOrderMutation']['id'],'handle'(_0xf88432,_0x4d7df8){let {params:_0x1bed4d}=_0x4d7df8;return H(_0x1bed4d['unitId'],[h['WorkbookMoveSheetPermission']]);}},{'id':te['SetSheetsFilterRangeMutation']['id'],'handle'(_0x1a336d,_0x1ce93f){let {params:_0x475a7f}=_0x1ce93f;return V(_0x1a336d,_0x475a7f['unitId'],_0x475a7f['subUnitId'],[_0x475a7f['range']],{'worksheetTypes':[h['WorksheetViewPermission']],'rangeTypes':[h['RangeProtectionPermissionViewPoint']]});}},{'id':h['SetWorksheetProtectionMutation']['id'],'handle'(_0x27c7a2,_0x4ab3e8){let {params:_0x576eb5}=_0x4ab3e8,{unitId:_0x32a285,subUnitId:_0x134bb4}=_0x576eb5;return[new h['WorksheetManageCollaboratorPermission'](_0x32a285,_0x134bb4)];}},{'id':_['UpdateDataValidationMutation']['id'],'handle'(_0x394d93,_0x4d6b2d){let {unitId:_0x716678,subUnitId:_0x5eef95,ruleId:_0x273698,payload:_0x5b1e32}=_0x4d6b2d['params'];if(!B(_0x394d93,_0x716678))return[];let _0x546d84=_0x394d93['get'](_['DataValidationModel']),_0xbcafa6=(Array['isArray'](_0x273698)?_0x273698:[_0x273698])['map'](_0x3a04bb=>_0x546d84['getRuleById'](_0x716678,_0x5eef95,_0x3a04bb)),_0xf266a9=[];return _0xbcafa6['forEach'](_0x37f03a=>{_0x37f03a?.['ranges']&&_0xf266a9['push'](..._0x37f03a['ranges']);}),_0x5b1e32['type']===_['UpdateRuleType']['RANGE']&&_0xf266a9['push'](..._0x5b1e32['payload']),V(_0x394d93,_0x716678,_0x5eef95,_0xf266a9,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}}];function Vt(_0x553d23,_0xa722e5,_0x3c354e){let _0x19e9da=_0x3c354e;if(_0x19e9da['unitId']!==_0xa722e5)throw U('Permission\x20point\x20identifies\x20another\x20Unit');switch(_0x19e9da['type']){case c['UnitObject']['Workbook']:return{'objectID':_0xa722e5,'objectType':_0x19e9da['type'],'action':_0x19e9da['subType']};case c['UnitObject']['Worksheet']:return Ht(_0x553d23,_0xa722e5,_0x19e9da);case c['UnitObject']['SelectRange']:if(!_0x19e9da['permissionId'])throw U('Range\x20permission\x20point\x20has\x20no\x20object\x20ID');return{'objectID':_0x19e9da['permissionId'],'objectType':_0x19e9da['type'],'action':_0x19e9da['subType']};default:throw U('Unsupported\x20Sheet\x20permission\x20point\x20type');}}function Ht(_0x576c05,_0x40f797,_0x3dd2f8){if(!_0x3dd2f8['subUnitId'])throw U('Worksheet\x20permission\x20point\x20has\x20no\x20subUnit\x20ID');let _0x4f95e6;if(h['baseProtectionActions']['includes'](_0x3dd2f8['subType'])?_0x4f95e6=_0x576c05['get'](h['WorksheetProtectionRuleModel'])['getRule'](_0x40f797,_0x3dd2f8['subUnitId'])?.['permissionId']:h['defaultWorksheetPermissionPoint']['includes'](_0x3dd2f8['subType'])&&(_0x4f95e6=_0x576c05['get'](h['WorksheetProtectionPointModel'])['getRule'](_0x40f797,_0x3dd2f8['subUnitId'])?.['permissionId']),_0x4f95e6)return{'objectID':_0x4f95e6,'objectType':c['UnitObject']['Worksheet'],'action':_0x3dd2f8['subType']};}function U(_0x151c24){return new S('INVALID_REQUEST',_0x151c24);}var Ut=new Map(Bt['map'](_0x1d0f18=>[_0x1d0f18['id'],_0x1d0f18]));function Wt(_0x253be0,_0x262b91,_0x4c1235){let _0x78141b=Ut['get'](_0x4c1235['id']);if(!_0x78141b)return[];let _0x2705e1=_0x78141b['handle'](_0x253be0,_0x4c1235);if(_0x2705e1===!0x1)throw new S('INVALID_REQUEST','Mutation\x20permission\x20analysis\x20failed\x20for\x20'+_0x4c1235['id']);let _0x5d8c2e=[];for(let _0x19618c of _0x2705e1){let _0xc0cd86=Vt(_0x253be0,_0x262b91,_0x19618c);_0xc0cd86&&_0x5d8c2e['push']({'unitID':_0x262b91,..._0xc0cd86});}return _0x5d8c2e;}var Gt={'name':'SLIDE_OBJECT_PERMISSION_PLUGIN','business':u['UniverInstanceType']['UNIVER_SLIDE'],'objectTypes':new Set([c['UnitObject']['SlidePage'],c['UnitObject']['SlideElement'],c['UnitObject']['SlideMaster']]),'label':'Slide'};function Kt(_0x54f692,_0x117cd3){return A(_0x54f692,_0x117cd3,Gt);}var qt=class{['model'];['resourceService'];['targets']=new Set();constructor(_0x2ecdd9,_0x8bf76b){this['model']=_0x2ecdd9,this['resourceService']=_0x8bf76b;}['collect'](_0x5668d0){return this['_checkChartMutation'](_0x5668d0),this['targets'];}['add'](_0x2cd373){for(let _0x37aab8 of _0x2cd373)this['targets']['add'](_0x37aab8);}['_checkChartMutation'](_0x29d0dc){switch(_0x29d0dc['id']){case y['RemoveSlideChartDataSourceMutation']['id']:{let _0x18008f=_0x29d0dc['params'];return _0x18008f&&this['_assertDataSource'](_0x18008f['unitId'],_0x18008f['dataSourceId']),!0x0;}case y['RemoveSlideChartSnapshotMutation']['id']:{let _0x185c45=_0x29d0dc['params'];return _0x185c45&&this['_assertChart'](_0x185c45['unitId'],_0x185c45['chartId']),!0x0;}case y['SetSlideChartDataSourceMutation']['id']:{let _0x345b7c=_0x29d0dc['params'];return _0x345b7c&&this['_assertDataSource'](_0x345b7c['unitId'],_0x345b7c['dataSource']['id']),!0x0;}case y['SetSlideChartSnapshotMutation']['id']:{let _0x1d7af2=_0x29d0dc['params'];return _0x1d7af2&&this['_assertChart'](_0x1d7af2['unitId'],_0x1d7af2['chart']['id']),!0x0;}default:return!0x1;}}['_getSlideModel'](_0xd952b){return _0xd952b===this['model']['getUnitId']()?this['model']:void 0x0;}['_assertDataSource'](_0x2c7cdb,_0x4a4088){let _0x52f7ef=this['resourceService']['getChartIdsByDataSource'](_0x2c7cdb,_0x4a4088);this['_assertCharts'](_0x2c7cdb,_0x52f7ef);}['_assertChart'](_0x2f3ad6,_0x40603f){this['_assertCharts'](_0x2f3ad6,[_0x40603f]);}['_assertCharts'](_0x3b675d,_0x190d57){let _0x14a453=this['_getSlideModel'](_0x3b675d);if(!_0x14a453)return;let _0x71fac2=new Set(_0x190d57),_0x5bae27=(0x0,b['resolveMatchingSlideElementPermissionObjectIds'])(_0x14a453,_0x215454=>_0x215454['type']===b['PageElementTypeEnum']['Chart']&&_0x71fac2['has'](_0x215454['chartId']));this['add'](_0x5bae27);}['_assertPage'](_0x580b97,_0x215ba5,_0x46bf37){if(_0x46bf37){this['_assertElement'](_0x580b97,_0x215ba5,_0x46bf37);return;}let _0x2fd141=this['_getSlideModel'](_0x580b97);if(!_0x2fd141)return;let _0xf756b9=(0x0,b['getSlidePageType'])(_0x2fd141,_0x215ba5),_0x3b4ccf=[];_0xf756b9===b['PageTypeEnum']['Slide']?_0x3b4ccf['push']((0x0,b['getSlidePagePermissionObjectId'])(_0x215ba5)):(_0xf756b9===b['PageTypeEnum']['Master']||_0xf756b9===b['PageTypeEnum']['Layout'])&&_0x3b4ccf['push'](b['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']),this['add'](_0x3b4ccf);}['_assertElement'](_0x1e44fa,_0x212e7f,_0x3d182a){let _0x25c4c4=this['_getSlideModel'](_0x1e44fa);if(!_0x25c4c4)return;let _0x5dd70e=(0x0,b['getSlidePageType'])(_0x25c4c4,_0x212e7f)??b['PageTypeEnum']['Slide'],_0x15e784=new Set();(0x0,b['addSlideElementPermissionObjectIds'])(_0x25c4c4,_0x212e7f,_0x5dd70e,new Set([_0x3d182a]),_0x15e784),this['add'](_0x15e784);}},Jt=class{['model'];['targets']=new Set();constructor(_0x18733f){this['model']=_0x18733f;}['collect'](_0x319074){return this['_checkPresentationMutation'](_0x319074),this['_checkPageMutation'](_0x319074),this['_checkElementMutation'](_0x319074),this['_checkDrawingMutation'](_0x319074),this['targets'];}['add'](_0x5505b2){for(let _0x57c0fb of _0x5505b2)this['targets']['add'](_0x57c0fb);}['_checkPresentationMutation'](_0x26f9d7){switch(_0x26f9d7['id']){case b['EnsureSlideMasterPageMutation']['id']:{let _0x5d3725=_0x26f9d7['params'];return _0x5d3725&&this['_assertPageSnapshot'](_0x5d3725['unitId'],_0x5d3725['masterPage']),!0x0;}case'slide.mutation.set-name':{let _0xe8126c=_0x26f9d7['params'];return _0xe8126c&&this['_assertUnit'](_0xe8126c['unitId']),!0x0;}case b['SetSlidePageSizeMutation']['id']:{let _0x32bc9d=_0x26f9d7['params'];return _0x32bc9d&&this['_assertOptionalPage'](_0x32bc9d['unitId'],_0x32bc9d['pageId']),!0x0;}case b['SetPresentationBackgroundGraphicsMutation']['id']:{let _0x747d4f=_0x26f9d7['params'];return _0x747d4f&&this['_assertMasterView'](_0x747d4f['unitId']),!0x0;}case b['SetSlideTransitionMutation']['id']:{let _0x27e26a=_0x26f9d7['params'];return _0x27e26a&&this['_assertPages'](_0x27e26a['unitId'],Object['keys'](_0x27e26a['slideTransitionRefs']??{})),!0x0;}default:return!0x1;}}['_checkPageMutation'](_0x574817){switch(_0x574817['id']){case b['AddSlidePageMutation']['id']:{let _0x592a1d=_0x574817['params'];return _0x592a1d&&this['_assertPageSnapshot'](_0x592a1d['unitId'],_0x592a1d['slide']),!0x0;}case b['MoveSlidePageMutation']['id']:{let _0x5962c1=_0x574817['params'];return _0x5962c1&&this['_assertPage'](_0x5962c1['unitId'],_0x5962c1['subUnitId']),!0x0;}case b['RemoveSlidePageMutation']['id']:{let _0x44fe92=_0x574817['params'];return _0x44fe92&&this['_assertPageWithElements'](_0x44fe92['unitId'],_0x44fe92['subUnitId']),!0x0;}case'slide.mutation.set-slide-placeholder-suppression':{let _0x684e98=_0x574817['params'];return _0x684e98&&this['_assertPage'](_0x684e98['unitId'],_0x684e98['subUnitId']),!0x0;}case b['SetSlideSpeakerNotesMutation']['id']:{let _0x19a62f=_0x574817['params'];return _0x19a62f&&this['_assertPage'](_0x19a62f['unitId'],_0x19a62f['subUnitId']),!0x0;}case b['UpdateSlidePageBackgroundMutation']['id']:{let _0x1f7270=_0x574817['params'];return _0x1f7270&&this['_assertPage'](_0x1f7270['unitId'],_0x1f7270['pageId']),!0x0;}default:return!0x1;}}['_checkElementMutation'](_0x1ee7e2){switch(_0x1ee7e2['id']){case b['AddSlideElementMutation']['id']:{let _0x541604=_0x1ee7e2['params'];return _0x541604&&this['_assertElements'](_0x541604['unitId'],_0x541604['subUnitId'],[_0x541604['element']['id']],_0x541604['sourcePageType']),!0x0;}case b['InsertDrawingObjectMutation']['id']:{let _0x33d0ee=_0x1ee7e2['params'];return _0x33d0ee?.['drawings']['forEach'](_0x226c84=>this['_assertElements'](_0x33d0ee['unitId'],_0x33d0ee['subUnitId'],[_0x226c84['drawingId']],_0x226c84['sourcePageType'])),!0x0;}case b['RemoveSlideElementMutation']['id']:{let _0x35a7ec=_0x1ee7e2['params'];return _0x35a7ec&&this['_assertElements'](_0x35a7ec['unitId'],_0x35a7ec['subUnitId'],[_0x35a7ec['drawingId']]),!0x0;}case b['UpdateSlideElementMutation']['id']:{let _0x5185a1=_0x1ee7e2['params'];return _0x5185a1&&!_0x5185a1['formulaLastValueGuard']&&this['_assertElements'](_0x5185a1['unitId'],_0x5185a1['subUnitId'],[_0x5185a1['drawingId']]),!0x0;}default:return!0x1;}}['_checkDrawingMutation'](_0x31f5b4){switch(_0x31f5b4['id']){case b['SetSlideDrawingApplyMutation']['id']:{let _0xd751a=_0x31f5b4['params'];return _0xd751a&&this['_assertElements'](_0xd751a['unitId'],_0xd751a['subUnitId'],_0xd751a['objects']['map'](_0x2a16c0=>_0x2a16c0['drawingId'])),!0x0;}case b['SetSlideElementOrderMutation']['id']:{let _0x22ffe7=_0x31f5b4['params'];return _0x22ffe7&&this['_assertElements'](_0x22ffe7['unitId'],_0x22ffe7['subUnitId'],_0x22ffe7['drawingIds']),!0x0;}case b['SetSlideGroupMutation']['id']:{let _0x222465=_0x31f5b4['params'];return _0x222465&&this['_assertElements'](_0x222465['unitId'],_0x222465['subUnitId'],_0x222465['drawingIds']),!0x0;}case b['CancelSlideGroupMutation']['id']:{let _0x17ed86=_0x31f5b4['params'];return _0x17ed86&&this['_assertElements'](_0x17ed86['unitId'],_0x17ed86['subUnitId'],_0x17ed86['drawingIds']),!0x0;}default:return!0x1;}}['_getSlideModel'](_0x19d51c){return _0x19d51c===this['model']['getUnitId']()?this['model']:void 0x0;}['_assertUnit'](_0x343473){this['_getSlideModel'](_0x343473)&&this['add']([]);}['_assertOptionalPage'](_0x31f06f,_0x4549dc){if(_0x4549dc){this['_assertPage'](_0x31f06f,_0x4549dc);return;}this['_assertUnit'](_0x31f06f);}['_assertPage'](_0x3899fc,_0x4ce4b0,_0x1d94cc){let _0x3b87d2=this['_getSlideModel'](_0x3899fc);if(!_0x3b87d2)return;let _0x166fed=_0x1d94cc??(0x0,b['getSlidePageType'])(_0x3b87d2,_0x4ce4b0),_0x44b985=new Set();this['_addPageTarget'](_0x4ce4b0,_0x166fed,_0x44b985),this['add'](_0x44b985);}['_assertPages'](_0x567561,_0x5a7856){let _0xb8e2cb=this['_getSlideModel'](_0x567561);if(!_0xb8e2cb)return;let _0xd65c9e=new Set();_0x5a7856['forEach'](_0x4bf4dc=>this['_addPageTarget'](_0x4bf4dc,(0x0,b['getSlidePageType'])(_0xb8e2cb,_0x4bf4dc),_0xd65c9e)),this['add'](_0xd65c9e);}['_assertPageWithElements'](_0x4c686c,_0x397b75){let _0x33e9ac=this['_getSlideModel'](_0x4c686c);if(!_0x33e9ac)return;let _0x1525a2=_0x33e9ac['getSnapshot']()['slides'][_0x397b75],_0x584179=new Set();this['_addPageTarget'](_0x397b75,(0x0,b['getSlidePageType'])(_0x33e9ac,_0x397b75),_0x584179),(0x0,b['addSlideElementPermissionObjectIds'])(_0x33e9ac,_0x397b75,b['PageTypeEnum']['Slide'],new Set(Object['keys'](_0x1525a2?.['elements']??{})),_0x584179),this['add'](_0x584179);}['_assertElements'](_0x47758d,_0x22427d,_0x51af34,_0x5238b5){let _0x579da8=this['_getSlideModel'](_0x47758d);if(!_0x579da8)return;let _0x41d9bb=_0x5238b5??(0x0,b['getSlidePageType'])(_0x579da8,_0x22427d)??b['PageTypeEnum']['Slide'],_0x4ddfa7=new Set();(0x0,b['addSlideElementPermissionObjectIds'])(_0x579da8,_0x22427d,_0x41d9bb,new Set(_0x51af34),_0x4ddfa7),this['add'](_0x4ddfa7);}['_assertMasterView'](_0x140f34){this['_getSlideModel'](_0x140f34)&&this['add']([b['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']]);}['_assertPageSnapshot'](_0x2b2f95,_0x32d56f){if(!this['_getSlideModel'](_0x2b2f95))return;let _0x1723aa=new Set();this['_addPageTarget'](_0x32d56f['id'],_0x32d56f['pageType'],_0x1723aa),Object['keys'](_0x32d56f['elements'])['forEach'](_0x566bc5=>{_0x1723aa['add']((0x0,b['getSlideElementPermissionObjectId'])(_0x32d56f['pageType'],_0x32d56f['id'],_0x566bc5));}),this['add'](_0x1723aa);}['_addPageTarget'](_0x3ec0a0,_0x36d86a,_0x163d2d){_0x36d86a===b['PageTypeEnum']['Master']||_0x36d86a===b['PageTypeEnum']['Layout']?_0x163d2d['add'](b['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']):_0x36d86a===b['PageTypeEnum']['Slide']&&_0x163d2d['add']((0x0,b['getSlidePagePermissionObjectId'])(_0x3ec0a0));}},Yt=class{['model'];['targets']=new Set();constructor(_0x246c8c){this['model']=_0x246c8c;}['collect'](_0x48a6e3){return this['_checkTableMutation'](_0x48a6e3),this['targets'];}['add'](_0x26e42d){for(let _0x1c6ffd of _0x26e42d)this['targets']['add'](_0x1c6ffd);}['_checkTableMutation'](_0x2ed5d5){switch(_0x2ed5d5['id']){case x['RemoveSlideTableMutation']['id']:{let _0x4b4b29=_0x2ed5d5['params'];return _0x4b4b29&&this['_assertTable'](_0x4b4b29['unitId'],_0x4b4b29['tableId']),!0x0;}case x['SetSlideTableMutation']['id']:{let _0x380672=_0x2ed5d5['params'];return _0x380672&&this['_assertTable'](_0x380672['unitId'],_0x380672['table']['id']),!0x0;}default:return!0x1;}}['_getSlideModel'](_0x42c834){return _0x42c834===this['model']['getUnitId']()?this['model']:void 0x0;}['_assertTable'](_0x1ce8b1,_0x49f9d1,_0x421c72,_0x593050){if(_0x421c72&&_0x593050){this['_assertElement'](_0x1ce8b1,_0x421c72,_0x593050);return;}let _0x5aa669=this['_getSlideModel'](_0x1ce8b1);if(!_0x5aa669)return;let _0x4ec853=(0x0,b['resolveMatchingSlideElementPermissionObjectIds'])(_0x5aa669,_0x2b41a9=>_0x2b41a9['type']===b['PageElementTypeEnum']['Table']&&_0x2b41a9['tableId']===_0x49f9d1);this['add'](_0x4ec853);}['_assertPage'](_0x3ec9fb,_0x201dd3,_0x594105){if(_0x594105){this['_assertElement'](_0x3ec9fb,_0x201dd3,_0x594105);return;}let _0x551ba7=this['_getSlideModel'](_0x3ec9fb);if(!_0x551ba7)return;let _0x17d584=(0x0,b['getSlidePageType'])(_0x551ba7,_0x201dd3),_0xd8840b=[];_0x17d584===b['PageTypeEnum']['Slide']?_0xd8840b['push']((0x0,b['getSlidePagePermissionObjectId'])(_0x201dd3)):(_0x17d584===b['PageTypeEnum']['Master']||_0x17d584===b['PageTypeEnum']['Layout'])&&_0xd8840b['push'](b['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']),this['add'](_0xd8840b);}['_assertElement'](_0x26b19c,_0x378c65,_0xd8111a){let _0xf4fa3=this['_getSlideModel'](_0x26b19c);if(!_0xf4fa3)return;let _0x4e4dac=(0x0,b['getSlidePageType'])(_0xf4fa3,_0x378c65)??b['PageTypeEnum']['Slide'],_0x128b31=new Set();(0x0,b['addSlideElementPermissionObjectIds'])(_0xf4fa3,_0x378c65,_0x4e4dac,new Set([_0xd8111a]),_0x128b31),this['add'](_0x128b31);}},Xt=new Set([v['AddCommentMutation']['id'],v['DeleteCommentMutation']['id'],v['ResolveCommentMutation']['id'],v['UpdateCommentMutation']['id'],v['UpdateCommentRefMutation']['id']]);function Zt(_0x32b2bf,_0x108e5b,_0x4e3cef){if(Xt['has'](_0x4e3cef['id']))return[{'unitID':_0x108e5b,'objectID':_0x108e5b,'objectType':c['UnitObject']['Slide'],'action':c['UnitAction']['Comment']}];let _0x3165a9=_0x32b2bf['get'](u['IUniverInstanceService'])['getUnit'](_0x108e5b,u['UniverInstanceType']['UNIVER_SLIDE']),_0x2ff91b=new Set([...new Jt(_0x3165a9)['collect'](_0x4e3cef),...new qt(_0x3165a9,_0x32b2bf['get'](y['SlideChartResourceService']))['collect'](_0x4e3cef),...new Yt(_0x3165a9)['collect'](_0x4e3cef)]);return _0x2ff91b['size']===0x0?[]:E(_0x108e5b,_0x2ff91b,Kt(_0x32b2bf,_0x108e5b));}var Qt={[c['UniverType']['UNIVER_SHEET']]:c['UnitObject']['Workbook'],[c['UniverType']['UNIVER_DOC']]:c['UnitObject']['Document'],[c['UniverType']['UNIVER_SLIDE']]:c['UnitObject']['Slide'],[c['UniverType']['UNIVER_BOARD']]:c['UnitObject']['Board'],[c['UniverType']['UNIVER_BASE']]:c['UnitObject']['Base']},$t=class{['_handle'];['_requirements']=new Map();['_injector'];constructor(_0x3c3bb6,_0x5d9af3){this['_handle']=_0x5d9af3,this['_injector']=_0x3c3bb6['__getInjector']();}['collect'](_0x478125){let {unitID:_0x287393,type:_0x48ee90}=this['_handle'],_0x4bfb8a=_0x478125['params'];if(_0x4bfb8a?.['unitId']!==void 0x0&&_0x4bfb8a['unitId']!==_0x287393)throw new S('INVALID_REQUEST','Mutation\x20identifies\x20another\x20Unit');let _0x970fde=Qt[_0x48ee90];if(_0x970fde!==void 0x0){this['_add']({'unitID':_0x287393,'objectID':_0x287393,'objectType':_0x970fde,'action':c['UnitAction']['Edit']});for(let _0xd88138 of this['_collectUnitPermissions'](_0x478125))this['_add'](_0xd88138);}}['finish'](){return[...this['_requirements']['values']()];}['_collectUnitPermissions'](_0x49b1c9){let {unitID:_0x4f65a0,type:_0x23cf1b}=this['_handle'];switch(_0x23cf1b){case c['UniverType']['UNIVER_SHEET']:return Wt(this['_injector'],_0x4f65a0,_0x49b1c9);case c['UniverType']['UNIVER_DOC']:return Lt(this['_injector'],_0x4f65a0,_0x49b1c9);case c['UniverType']['UNIVER_SLIDE']:return Zt(this['_injector'],_0x4f65a0,_0x49b1c9);case c['UniverType']['UNIVER_BOARD']:return vt(this['_injector'],_0x4f65a0,_0x49b1c9);case c['UniverType']['UNIVER_BASE']:return ft(this['_injector'],_0x4f65a0,_0x49b1c9);default:return[];}}['_add'](_0x5d457c){let {unitID:_0x19b4f9,objectID:_0x307ac9,objectType:_0x2fcc5d,action:_0x1fad56}=_0x5d457c,_0x379576=JSON['stringify']([_0x19b4f9,_0x307ac9,_0x2fcc5d,_0x1fad56]);this['_requirements']['set'](_0x379576,_0x5d457c);}},en=class{['_transformService'];constructor(_0x41657b){this['_transformService']=_0x41657b;}['parseClient'](_0xa65a1e){try{return(0x0,l['parseProtocolChangeset'])(structuredClone(_0xa65a1e));}catch(_0x1fae57){throw new S('INVALID_REQUEST','Changeset\x20is\x20malformed',{'cause':_0x1fae57});}}['transform'](_0x16477d,_0x5bacee){let _0x3252d5;try{_0x3252d5=_0x5bacee['map'](_0x1f67f9=>(0x0,l['parseProtocolChangeset'])(structuredClone(_0x1f67f9)));}catch(_0x22fe68){throw new S('ADAPTER_FAILURE','Stored\x20changeset\x20cannot\x20be\x20parsed',{'retryable':!0x0,'cause':_0x22fe68});}let _0x3025db=_0x16477d;if(_0x3252d5['length']>0x0){let _0x2a0cc9=this['_transformService']['transformChangesets'](_0x3252d5,[_0x16477d],!0x1);if((0x0,l['isTransformChangesetsFailure'])(_0x2a0cc9)||!_0x2a0cc9['c2Prime'][0x0])throw new S('OT_CONFLICT','Changeset\x20cannot\x20be\x20transformed',{'cause':(0x0,l['isTransformChangesetsFailure'])(_0x2a0cc9)?_0x2a0cc9['error']:void 0x0});_0x3025db=_0x2a0cc9['c2Prime'][0x0];}try{return(0x0,l['parseChangesetToProtocol'])(_0x3025db);}catch(_0x161832){throw new S('INTERNAL_ERROR','Transformed\x20changeset\x20cannot\x20be\x20serialized',{'retryable':!0x0,'cause':_0x161832});}}},tn=new WeakSet();function nn(_0x1152f7){if(!tn['has'](_0x1152f7)){for(let _0x592825 of[rn,an])_0x1152f7['hasCommand'](_0x592825['id'])&&_0x1152f7['unregisterCommand'](_0x592825['id']),_0x1152f7['registerCommand'](_0x592825);tn['add'](_0x1152f7);}}var rn={'id':'doc.mutation.rich-text-editing','type':u['CommandType']['MUTATION'],'handler'(_0x12f591,_0x373fa7){let _0x2a3816=_0x12f591['get'](u['IUniverInstanceService'])['getUnit'](_0x373fa7['unitId'],u['UniverInstanceType']['UNIVER_DOC']);if(!_0x2a3816)return!0x1;if(!_0x373fa7['actions']||u['JSONX']['isNoop'](_0x373fa7['actions']))return!0x0;let _0x52ef1c=_0x2a3816['getSnapshot'](),_0x6660bc=u['JSONX']['invertWithDoc'](_0x373fa7['actions'],_0x52ef1c);_0x2a3816['apply'](_0x373fa7['actions']);let _0x58b23f=(0x0,l['validateDocumentAfterApply'])(_0x2a3816['getSnapshot']());if(!_0x58b23f['ok'])throw _0x2a3816['apply'](_0x6660bc),Error('Invalid\x20Doc\x20mutation\x20result:\x20'+_0x58b23f['errors']['join']('\x20'));return!0x0;}},an={'id':'doc.mutation.rename-doc','type':u['CommandType']['MUTATION'],'handler'(_0x5a4479,_0xf4685e){if(!_0xf4685e)return!0x1;let _0x36f18c=_0x5a4479['get'](u['IUniverInstanceService'])['getUnit'](_0xf4685e['unitId'],u['UniverInstanceType']['UNIVER_DOC']);return _0x36f18c?(_0x36f18c['setName'](_0xf4685e['name']),!0x0):!0x1;}},on={'code':c['ErrorCode']['OK'],'message':''},sn=class{['_reader'];['_contexts']=new WeakMap();['_capture']=new ne['AsyncLocalStorage']();constructor(_0xa1ab8c){this['_reader']=_0xa1ab8c;}['createContext'](_0x386bdf,_0x4f9cd6){let _0x56962e={};return this['_contexts']['set'](_0x56962e,{'databaseContext':_0x386bdf,..._0x4f9cd6?{'snapshot':_0x4f9cd6}:{}}),_0x56962e;}async['capture'](_0x48d356){let _0x3e51e1={'sheetBlocks':[]};return{'result':await this['_capture']['run'](_0x3e51e1,_0x48d356),..._0x3e51e1['snapshot']?{'snapshot':_0x3e51e1['snapshot']}:{},'sheetBlocks':_0x3e51e1['sheetBlocks']};}async['getUnitOnRev'](_0x417d5a,_0x247050){let _0x55488a=this['_requireBinding'](_0x417d5a),_0x3b4c8b=_0x55488a['snapshot']?.['unitID']===_0x247050['unitID']&&_0x55488a['snapshot']['type']===_0x247050['type']&&_0x55488a['snapshot']['rev']===_0x247050['revision']?_0x55488a['snapshot']:await this['_database'](()=>this['_reader']['getSnapshot'](_0x55488a['databaseContext'],_0x247050['unitID'],{'revision':_0x247050['revision']}));if(!_0x3b4c8b)throw G('Stored\x20Unit\x20snapshot\x20is\x20missing');if(_0x3b4c8b['unitID']!==_0x247050['unitID']||_0x3b4c8b['type']!==_0x247050['type']||!Number['isSafeInteger'](_0x3b4c8b['rev'])||_0x3b4c8b['rev']<0x1||_0x3b4c8b['rev']>_0x247050['revision']||!cn(_0x3b4c8b))throw G('Stored\x20Unit\x20snapshot\x20is\x20invalid');let _0x565aba=await this['_database'](()=>this['_reader']['getChangesets'](_0x55488a['databaseContext'],_0x247050['unitID'],{'from':_0x3b4c8b['rev'],'to':_0x247050['revision']}));if(_0x565aba===null)throw G('Stored\x20Unit\x20is\x20unavailable');return ln(_0x247050,_0x3b4c8b,_0x565aba),{'error':void 0x0,'snapshot':_0x3b4c8b,'changesets':[..._0x565aba]};}async['getSheetBlock'](_0x192bb1,_0x512bb6){let _0x33d85d=await this['_database'](()=>this['_reader']['getSheetBlock'](this['_requireContext'](_0x192bb1),_0x512bb6['unitID'],_0x512bb6['blockID']));if(!_0x33d85d)throw G('Stored\x20Sheet\x20block\x20'+_0x512bb6['blockID']+'\x20is\x20missing');return{'error':void 0x0,'block':_0x33d85d};}['getDeserializedSheetBlock'](_0x4af1d6,_0x285f38){return this['getSheetBlock'](_0x4af1d6,_0x285f38);}async['fetchMissingChangesets'](_0x49cbd9,_0x29dc7f){let _0x12273d=await this['_database'](()=>this['_reader']['getChangesets'](this['_requireContext'](_0x49cbd9),_0x29dc7f['unitID'],{'from':_0x29dc7f['from'],..._0x29dc7f['to']===0x0?{}:{'to':_0x29dc7f['to']}}));if(_0x12273d===null)throw G('Stored\x20Unit\x20is\x20unavailable');return{'error':void 0x0,'changesets':[..._0x12273d]};}['getResourcesRequest'](_0x44a363,_0x5cf0a6){return Promise['resolve']({'error':void 0x0,'resources':{}});}async['saveSnapshot'](_0x5a5099,_0x52658e){let _0x5da777=this['_requireCapture']();if(!_0x52658e['snapshot'])throw Error('SnapshotService\x20attempted\x20to\x20save\x20an\x20empty\x20snapshot');return _0x5da777['snapshot']=_0x52658e['snapshot'],{'error':on};}['updateSnapshot'](_0x2ae1f0,_0x2d439e){return this['saveSnapshot'](_0x2ae1f0,_0x2d439e);}async['saveSheetBlock'](_0x2aa42c,_0x32dc0c){let _0x4d734a=this['_requireCapture']();if(!_0x32dc0c['block'])throw Error('SnapshotService\x20attempted\x20to\x20save\x20an\x20empty\x20Sheet\x20block');return _0x4d734a['sheetBlocks']['push'](_0x32dc0c['block']),{'error':on,'blockID':_0x32dc0c['block']['id']};}['saveChangeset'](_0x1a0742,_0x3407c3){return W('saveChangeset');}['copyFileMeta'](_0x42772a,_0x2c2c1c){return W('copyFileMeta');}['getLatestCsReqIdBySid'](_0x12d0e3,_0x457261){return W('getLatestCsReqIdBySid');}['_requireBinding'](_0x4557f9){let _0x563a60=this['_contexts']['get'](_0x4557f9);if(!_0x563a60)throw Error('Snapshot\x20operation\x20is\x20missing\x20its\x20Database\x20context');return _0x563a60;}['_requireContext'](_0x3aeb4f){return this['_requireBinding'](_0x3aeb4f)['databaseContext'];}['_requireCapture'](){let _0x3ab979=this['_capture']['getStore']();if(!_0x3ab979)throw Error('Snapshot\x20save\x20was\x20called\x20outside\x20a\x20capture\x20operation');return _0x3ab979;}async['_database'](_0xba985a){try{return await _0xba985a();}catch(_0x20088f){throw _0x20088f instanceof S?_0x20088f:new S('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x20088f});}}};function W(_0x244d83){return Promise['reject'](Error('SnapshotAdapterBridge\x20does\x20not\x20support\x20'+_0x244d83));}function G(_0x3b6490){return new S('ADAPTER_FAILURE',_0x3b6490,{'retryable':!0x0});}function cn(_0x11635e){switch(_0x11635e['type']){case c['UniverType']['UNIVER_SHEET']:case c['UniverType']['UNIVER_BASE']:return _0x11635e['workbook']!==void 0x0;case c['UniverType']['UNIVER_DOC']:return _0x11635e['doc']!==void 0x0;case c['UniverType']['UNIVER_SLIDE']:return _0x11635e['slide']!==void 0x0;case c['UniverType']['UNIVER_BOARD']:return _0x11635e['board']!==void 0x0;default:return!0x1;}}function ln(_0x5a5298,_0x3da141,_0x188ea0){let _0x54eeea=_0x3da141['rev']+0x1;for(let _0x2f48c3 of _0x188ea0){if(_0x2f48c3['unitID']!==_0x5a5298['unitID']||_0x2f48c3['type']!==_0x5a5298['type']||_0x2f48c3['baseRev']!==_0x54eeea-0x1||_0x2f48c3['revision']!==_0x54eeea)throw G('Stored\x20changeset\x20history\x20is\x20not\x20contiguous');_0x54eeea+=0x1;}if(_0x54eeea-0x1!==_0x5a5298['revision'])throw G('Stored\x20changeset\x20history\x20is\x20incomplete');}function un(_0x476b6c){_0x476b6c['registerPlugin'](l['UniverCollaborationPlugin']),dn(_0x476b6c),fn(_0x476b6c),pn(_0x476b6c),mn(_0x476b6c),hn(_0x476b6c),gn(_0x476b6c);}function dn(_0x528afe){_0x528afe['registerPlugin'](v['UniverThreadCommentPlugin']),_0x528afe['registerPlugin'](Ce['UniverThreadCommentResourcePlugin']),_0x528afe['registerPlugin'](De['UniverDrawingPlugin']),_0x528afe['registerPlugin'](he['UniverEmbedPlugin']);}function fn(_0x48ba11){_0x48ba11['registerPlugin'](Te['UniverDocsHyperLinkPlugin']),_0x48ba11['registerPlugin'](we['UniverDocsDrawingPlugin']),_0x48ba11['registerPlugin'](le['UniverDocsCalloutPlugin']),_0x48ba11['registerPlugin'](ue['UniverDocsChartPlugin']),_0x48ba11['registerPlugin'](de['UniverDocsCodePlugin']),_0x48ba11['registerPlugin'](fe['UniverDocsLatexPlugin']),_0x48ba11['registerPlugin'](pe['UniverDocsShapePlugin']),_0x48ba11['registerPlugin'](me['UniverDocsTablePlugin']),_0x48ba11['registerPlugin'](Ee['UniverDocsThreadCommentPlugin']);}function pn(_0x58cb9b){_0x58cb9b['registerPlugin'](h['UniverSheetsPlugin']),_0x58cb9b['registerPlugin'](ge['UniverRustFormulaEnginePlugin'],{}),_0x58cb9b['registerPlugin'](ke['UniverSheetsFormulaPlugin']),_0x58cb9b['registerPlugin'](g['UniverSheetsConditionalFormattingPlugin']),_0x58cb9b['registerPlugin'](_['UniverDataValidationPlugin']),_0x58cb9b['registerPlugin'](te['UniverSheetsFilterPlugin']),_0x58cb9b['registerPlugin'](Ae['UniverSheetsHyperLinkPlugin']),_0x58cb9b['registerPlugin'](ye['UniverSheetsPivotTablePlugin']),_0x58cb9b['registerPlugin'](Ne['UniverSheetsTablePlugin']),_0x58cb9b['registerPlugin'](ve['UniverSheetsOutlinePlugin']),_0x58cb9b['registerPlugin'](xe['UniverSheetSparklinePlugin']),_0x58cb9b['registerPlugin'](Oe['UniverSheetsDrawingPlugin']),_0x58cb9b['registerPlugin'](Me['UniverSheetsSortPlugin']),_0x58cb9b['registerPlugin'](_e['UniverSheetsChartPlugin']),_0x58cb9b['registerPlugin'](je['UniverSheetsNotePlugin']),_0x58cb9b['registerPlugin'](be['UniverSheetsShapePlugin']),_0x58cb9b['registerPlugin'](Pe['UniverSheetsThreadCommentPlugin']);}function mn(_0x1015e4){_0x1015e4['registerPlugin'](b['UniverSlidesPlugin']),_0x1015e4['registerPlugin'](y['UniverSlidesChartPlugin']),_0x1015e4['registerPlugin'](x['UniverSlidesTablePlugin']),_0x1015e4['registerPlugin'](Se['UniverSlidesThreadCommentPlugin']);}function hn(_0x1a3aa5){_0x1a3aa5['registerPlugin'](ee['UniverBoardsPlugin']),_0x1a3aa5['registerPlugin'](ae['UniverBoardsChartPlugin']),_0x1a3aa5['registerPlugin'](se['UniverBoardsTablePlugin']),_0x1a3aa5['registerPlugin'](oe['UniverBoardsMindPlugin']),_0x1a3aa5['registerPlugin'](ce['UniverBoardsThreadCommentPlugin']);}function gn(_0x27b0dc){_0x27b0dc['registerPlugin'](p['UniverBasesPlugin']),_0x27b0dc['registerPlugin'](re['UniverBaseDashboardPlugin'],{'notExecuteCalculation':!0x0}),_0x27b0dc['registerPlugin'](ie['UniverBasesThreadCommentPlugin']);}var _n=0x32,vn=0x2bf20,yn=0x7530,bn=class{['unitID'];['type'];['_revision'];constructor(_0x36e8d1,_0x29a511,_0x2080b4){this['unitID']=_0x36e8d1,this['type']=_0x29a511,this['_revision']=_0x2080b4;}get['revision'](){return this['_revision'];}['advanceTo'](_0xf2d93a){this['_revision']=_0xf2d93a;}},K=class{['changesetTransformer'];['_reader'];['_maxLoadedUnits'];['_idleTimeoutMs'];['_univer'];['_instanceService'];['_commandService'];['_revisionService'];['_compressMutationService'];['_snapshotService'];['_snapshotSaveService'];['_formulaCalculationSessionService'];['_snapshotBridge'];['_entries']=new Map();['_ensuring']=new Map();['_disposed']=!0x1;constructor(_0x1c74ac){if(this['_reader']=_0x1c74ac['reader'],this['_maxLoadedUnits']=_0x1c74ac['maxLoadedUnits']??_n,this['_idleTimeoutMs']=_0x1c74ac['idleTimeoutMs']??vn,!Number['isSafeInteger'](this['_maxLoadedUnits'])||this['_maxLoadedUnits']<0x1)throw TypeError('maxLoadedUnits\x20must\x20be\x20a\x20positive\x20safe\x20integer');if(!Number['isSafeInteger'](this['_idleTimeoutMs'])||this['_idleTimeoutMs']<0x1)throw TypeError('idleTimeoutMs\x20must\x20be\x20a\x20positive\x20safe\x20integer');this['_univer']=new u['Univer']({'locale':u['LocaleType']['EN_US'],'locales':{[u['LocaleType']['EN_US']]:f['default']},'logLevel':u['LogLevel']['SILENT']}),this['_snapshotBridge']=new sn(this['_reader']);let _0x48de6f=this['_univer']['__getInjector']();_0x48de6f['add']([l['ISnapshotServerService'],{'useValue':this['_snapshotBridge']}]),_0x48de6f['add']([l['SnapshotSaveService']]),un(this['_univer']),this['_instanceService']=_0x48de6f['get'](u['IUniverInstanceService']),this['_commandService']=_0x48de6f['get'](u['ICommandService']),this['_revisionService']=_0x48de6f['get'](l['RevisionService']),this['_compressMutationService']=_0x48de6f['get'](l['CompressMutationService']),this['changesetTransformer']=new en(_0x48de6f['get'](l['ITransformService'])),this['_snapshotService']=_0x48de6f['get'](l['SnapshotService']),this['_snapshotSaveService']=_0x48de6f['get'](l['SnapshotSaveService']),this['_formulaCalculationSessionService']=_0x48de6f['get'](d['FormulaCalculationSessionService']);}['ensureUnit'](_0xa4f72e,_0x396acd,_0x2d9703){this['_assertOpen']();let _0x329b67=this['_ensuring']['get'](_0x396acd);if(_0x329b67)return _0x329b67['then'](_0x577847=>this['_retain'](_0x577847));let _0x1970f4=this['_ensureUnit'](_0xa4f72e,_0x396acd,_0x2d9703)['finally'](()=>{this['_ensuring']['get'](_0x396acd)===_0x1970f4&&this['_ensuring']['delete'](_0x396acd);});return this['_ensuring']['set'](_0x396acd,_0x1970f4),_0x1970f4['then'](_0x3abaa0=>this['_adoptReservation'](_0x3abaa0));}['releaseUnit'](_0x57acf4){let _0x2388ce=this['_entries']['get'](_0x57acf4['unitID']);if(!(!_0x2388ce||_0x2388ce['handle']!==_0x57acf4)){if(_0x2388ce['busy']<0x1)throw Error('Unit\x20Runtime\x20lease\x20was\x20released\x20more\x20than\x20once');--_0x2388ce['busy'],this['_touch'](_0x2388ce),this['_evictOverCapacity']();}}async['applyChangeset'](_0x4ee60c,_0x57e5f1,_0x10f555,_0x194670={}){this['_assertOpen']();let _0x15ef1f=this['_requireEntry'](_0x57e5f1);return this['_withBusy'](_0x15ef1f,async()=>{try{return await this['_applyConfirmedChangeset'](_0x4ee60c,_0x15ef1f['handle'],_0x10f555,_0x194670);}catch(_0x4f0cce){throw this['disposeUnit'](_0x57e5f1['unitID']),_0x4f0cce instanceof S?_0x4f0cce:new S('INTERNAL_ERROR','Failed\x20to\x20apply\x20changeset\x20to\x20Unit\x20Runtime',{'retryable':!0x0,'cause':_0x4f0cce});}});}async['createSnapshot'](_0x75ea65){this['_assertOpen']();let _0x1a48ce=this['_requireEntry'](_0x75ea65);return this['_withBusy'](_0x1a48ce,async()=>{try{let _0x2e651a=await this['_snapshotBridge']['capture'](()=>this['_createProtocolSnapshot'](_0x1a48ce['handle'])),_0x533779=_0x2e651a['result']['snapshot']??_0x2e651a['snapshot'];if(!_0x533779)throw Error('SDK\x20snapshot\x20generation\x20returned\x20no\x20snapshot');return{'snapshot':_0x533779,..._0x2e651a['sheetBlocks']['length']>0x0?{'sheetBlocks':_0x2e651a['sheetBlocks']}:{}};}catch(_0x519769){throw this['disposeUnit'](_0x75ea65['unitID']),new S('INTERNAL_ERROR','Failed\x20to\x20create\x20Unit\x20Runtime\x20snapshot',{'retryable':!0x0,'cause':_0x519769});}});}['disposeUnit'](_0x11ee16){let _0x2cd73f=this['_entries']['get'](_0x11ee16);_0x2cd73f?.['idleTimer']&&clearTimeout(_0x2cd73f['idleTimer']),this['_entries']['delete'](_0x11ee16),this['_instanceService']['disposeUnit'](_0x11ee16);}async['dispose'](){if(!this['_disposed']){this['_disposed']=!0x0;for(let _0x5959ef of[...this['_entries']['keys']()])this['disposeUnit'](_0x5959ef);this['_ensuring']['clear'](),this['_univer']['dispose']();}}async['_ensureUnit'](_0x42b487,_0x5bc301,_0x4d1d5d){xn(_0x5bc301,_0x4d1d5d);let _0x142e89=await this['_database'](()=>this['_reader']['getUnit'](_0x42b487,_0x5bc301));if(!_0x142e89)throw new S('UNIT_NOT_FOUND','Unit\x20'+_0x5bc301+'\x20does\x20not\x20exist');if(_0x142e89['unitID']!==_0x5bc301)throw new S('ADAPTER_FAILURE','Stored\x20Unit\x20metadata\x20belongs\x20to\x20a\x20different\x20identity',{'retryable':!0x0});if(_0x142e89['type']!==_0x4d1d5d)throw new S('INVALID_REQUEST','Unit\x20type\x20does\x20not\x20match\x20the\x20stored\x20Unit');if(!Number['isSafeInteger'](_0x142e89['headRevision'])||_0x142e89['headRevision']<0x1)throw new S('ADAPTER_FAILURE','Stored\x20Unit\x20metadata\x20is\x20invalid',{'retryable':!0x0});let _0x55f099=this['_entries']['get'](_0x5bc301);if(_0x55f099&&_0x55f099['handle']['type']!==_0x4d1d5d&&(this['disposeUnit'](_0x5bc301),_0x55f099=void 0x0),_0x55f099&&_0x55f099['handle']['revision']>_0x142e89['headRevision']&&(this['disposeUnit'](_0x5bc301),_0x55f099=void 0x0),_0x55f099)try{return await this['_withBusy'](_0x55f099,async()=>{_0x55f099['handle']['revision']<_0x142e89['headRevision']&&await this['_replayRange'](_0x42b487,_0x55f099['handle'],_0x55f099['handle']['revision'],_0x142e89['headRevision']);},!0x1),_0x55f099['busy']+=0x1,_0x55f099['handle'];}catch{this['disposeUnit'](_0x5bc301);}return this['_loadUnit'](_0x42b487,_0x5bc301,_0x4d1d5d,_0x142e89['headRevision']);}async['_loadUnit'](_0xabdfad,_0x2441ae,_0x3acbcf,_0x290d30){let _0x452b1c=await this['_database'](()=>this['_reader']['getSnapshot'](_0xabdfad,_0x2441ae,{'revision':_0x290d30}));if(!_0x452b1c||_0x452b1c['unitID']!==_0x2441ae||_0x452b1c['type']!==_0x3acbcf||!Number['isSafeInteger'](_0x452b1c['rev'])||_0x452b1c['rev']<0x1||_0x452b1c['rev']>_0x290d30)throw new S('ADAPTER_FAILURE','Stored\x20Unit\x20snapshot\x20is\x20invalid',{'retryable':!0x0});try{if(await this['_loadSdkUnit'](_0xabdfad,_0x2441ae,_0x3acbcf,_0x452b1c['rev'],_0x452b1c),this['_revisionService']['getCurrentRevOfUnit'](_0x2441ae)!==_0x452b1c['rev'])throw Error('SDK\x20loaded\x20Unit\x20at\x20an\x20unexpected\x20revision');let _0x225147=new bn(_0x2441ae,_0x3acbcf,_0x452b1c['rev']),_0x69327c={'handle':_0x225147,'busy':0x1};if(this['_entries']['set'](_0x2441ae,_0x69327c),_0x452b1c['rev']<_0x290d30&&await this['_replayRange'](_0xabdfad,_0x225147,_0x452b1c['rev'],_0x290d30),_0x225147['revision']!==_0x290d30)throw Error('Runtime\x20did\x20not\x20reach\x20the\x20requested\x20revision');return _0x225147;}catch(_0x49d38c){throw this['disposeUnit'](_0x2441ae),_0x49d38c instanceof S?_0x49d38c:new S('INTERNAL_ERROR','Failed\x20to\x20load\x20Unit\x20Runtime',{'retryable':!0x0,'cause':_0x49d38c});}}async['_loadSdkUnit'](_0x30c31d,_0x366585,_0xa83496,_0x4acecf,_0x1988c2){let _0x428c5c=this['_snapshotBridge']['createContext'](_0x30c31d,_0x1988c2);switch(_0xa83496){case c['UniverType']['UNIVER_SHEET']:await this['_snapshotService']['loadSheet'](_0x366585,_0x4acecf,_0x428c5c);return;case c['UniverType']['UNIVER_DOC']:await this['_snapshotService']['loadDoc'](_0x366585,_0x4acecf,_0x428c5c),nn(this['_commandService']);return;case c['UniverType']['UNIVER_SLIDE']:await this['_snapshotService']['loadSlide'](_0x366585,_0x4acecf,_0x428c5c);return;case c['UniverType']['UNIVER_BOARD']:await this['_snapshotService']['loadBoard'](_0x366585,_0x4acecf,_0x428c5c);return;case c['UniverType']['UNIVER_BASE']:await this['_snapshotService']['loadBase'](_0x366585,_0x4acecf,_0x428c5c);return;}throw Error('Unsupported\x20Unit\x20type:\x20'+_0xa83496);}async['_createProtocolSnapshot'](_0x48f1b1){let _0x5ef74c={};switch(_0x48f1b1['type']){case c['UniverType']['UNIVER_SHEET']:{await this['_formulaCalculationSessionService']['waitForLatestApplied'](yn);let _0x17462e=this['_requireSdkUnit'](_0x48f1b1,u['UniverInstanceType']['UNIVER_SHEET']),_0x35fbdc=await this['_snapshotSaveService']['getSheet'](_0x5ef74c,_0x48f1b1['unitID'],_0x48f1b1['revision'],_0x17462e);if(!_0x35fbdc['snapshot']['workbook'])throw Error('SDK\x20Sheet\x20snapshot\x20has\x20no\x20workbook\x20payload');return{..._0x35fbdc,'snapshot':{..._0x35fbdc['snapshot'],'workbook':{..._0x35fbdc['snapshot']['workbook'],'sheetOrder':_0x17462e['getSheets']()['map'](_0xc86989=>_0xc86989['getSheetId']())}}};}case c['UniverType']['UNIVER_DOC']:{let _0x8d5cd9=this['_requireSdkUnit'](_0x48f1b1,u['UniverInstanceType']['UNIVER_DOC']);return this['_snapshotSaveService']['getDoc'](_0x5ef74c,_0x48f1b1['unitID'],_0x48f1b1['revision'],_0x8d5cd9);}case c['UniverType']['UNIVER_SLIDE']:{let _0x56a863=this['_requireSdkUnit'](_0x48f1b1,u['UniverInstanceType']['UNIVER_SLIDE']);return this['_snapshotService']['saveSlide'](_0x48f1b1['unitID'],_0x56a863['getSnapshot'](),_0x48f1b1['revision']);}case c['UniverType']['UNIVER_BOARD']:{let _0x33a203=this['_requireSdkUnit'](_0x48f1b1,u['UniverInstanceType']['UNIVER_BOARD']);return this['_snapshotService']['saveBoard'](_0x48f1b1['unitID'],_0x33a203['getSnapshot'](),_0x48f1b1['revision']);}case c['UniverType']['UNIVER_BASE']:{let _0x63395e=this['_requireSdkUnit'](_0x48f1b1,u['UniverInstanceType']['UNIVER_BASE']);return this['_snapshotSaveService']['getBase'](_0x5ef74c,_0x48f1b1['unitID'],_0x48f1b1['revision'],_0x63395e);}}throw Error('Unsupported\x20Unit\x20type:\x20'+_0x48f1b1['type']);}['_requireSdkUnit'](_0x5a2d55,_0x7746ed){let _0x5e483b=this['_instanceService']['getUnit'](_0x5a2d55['unitID'],_0x7746ed);if(!_0x5e483b||this['_revisionService']['getCurrentRevOfUnit'](_0x5a2d55['unitID'])!==_0x5a2d55['revision'])throw Error('Runtime\x20Unit\x20or\x20revision\x20is\x20unavailable');return _0x5e483b;}async['_replayRange'](_0x35bd02,_0x23b584,_0x2adfa2,_0x9b6998){let _0x199cc0=await this['_database'](()=>this['_reader']['getChangesets'](_0x35bd02,_0x23b584['unitID'],{'from':_0x2adfa2,'to':_0x9b6998}));if(_0x199cc0===null)throw new S('ADAPTER_FAILURE','Unit\x20is\x20unavailable\x20during\x20replay',{'retryable':!0x0});let _0xc99a42=_0x2adfa2+0x1;for(let _0x46e268 of _0x199cc0){if(_0x46e268['unitID']!==_0x23b584['unitID']||_0x46e268['type']!==_0x23b584['type']||_0x46e268['baseRev']!==_0xc99a42-0x1||_0x46e268['revision']!==_0xc99a42)throw new S('ADAPTER_FAILURE','Stored\x20changeset\x20history\x20is\x20not\x20contiguous',{'retryable':!0x0});await this['_applyConfirmedChangeset'](_0x35bd02,_0x23b584,_0x46e268),_0xc99a42+=0x1;}if(_0xc99a42-0x1!==_0x9b6998)throw new S('ADAPTER_FAILURE','Stored\x20changeset\x20history\x20is\x20incomplete',{'retryable':!0x0});}async['_applyConfirmedChangeset'](_0x1257b3,_0x3cb0ab,_0x4bfabd,_0x3970c2={}){if(_0x4bfabd['unitID']!==_0x3cb0ab['unitID']||_0x4bfabd['type']!==_0x3cb0ab['type']||_0x4bfabd['baseRev']!==_0x3cb0ab['revision']||_0x4bfabd['revision']!==_0x3cb0ab['revision']+0x1)throw Error('Changeset\x20does\x20not\x20follow\x20the\x20Runtime\x20revision');let _0x2d4af5=(0x0,l['parseProtocolChangeset'])(_0x4bfabd),_0x57591f=_0x2d4af5['mutations']['find'](_0x2fb77f=>_0x2fb77f['id']===l['RevertRevisionMutation']['id']);if(_0x57591f){if(_0x2d4af5['mutations']['length']!==0x1)throw new S('INVALID_REQUEST','A\x20restore\x20changeset\x20cannot\x20contain\x20other\x20mutations');let _0x21a54d=_0x57591f['params'];if(_0x21a54d['unitId']!==_0x3cb0ab['unitID']||!Number['isSafeInteger'](_0x21a54d['revision'])||_0x21a54d['revision']<0x1||_0x21a54d['revision']>_0x4bfabd['baseRev'])throw new S('INVALID_REQUEST','Restore\x20target\x20must\x20identify\x20an\x20existing\x20revision\x20of\x20this\x20Unit');let _0x261fea={'requiredUnitPermissions':[]};if(_0x3970c2['collectUnitPermissions']){let _0x19a0fd=new $t(this['_univer'],_0x3cb0ab),_0x1bc647=performance['now']();_0x19a0fd['collect'](_0x57591f);let _0x455cb6=performance['now']()-_0x1bc647;_0x261fea={'requiredUnitPermissions':_0x19a0fd['finish'](),'permissionAnalysisDurationMs':_0x455cb6};}return await this['_restoreHistoricalRevision'](_0x1257b3,_0x3cb0ab,_0x4bfabd,_0x21a54d['revision']),_0x261fea;}let _0x570ffe=this['_compressMutationService']['interceptor']['fetchThroughInterceptors'](this['_compressMutationService']['interceptor']['getInterceptPoints']()['COMPRESS_MUTATION_APPLY'])(_0x2d4af5['mutations'],null)??_0x2d4af5['mutations'],_0x10d36f=this['_applyMutations'](_0x3cb0ab,_0x4bfabd,_0x570ffe,_0x3970c2['collectUnitPermissions']===!0x0),_0x23ac62=this['_revisionService']['incrementRevOfUnit'](_0x3cb0ab['unitID']);if(_0x23ac62!==_0x4bfabd['revision'])throw Error('Univer\x20Runtime\x20revision\x20did\x20not\x20advance\x20as\x20expected');return _0x3cb0ab['advanceTo'](_0x23ac62),_0x10d36f;}['_applyMutations'](_0x93a353,_0x8073a3,_0x576a63,_0x2ead67){if(!_0x2ead67)return this['_executeMutationBatch'](_0x8073a3,_0x576a63),{'requiredUnitPermissions':[]};let _0x25e9c4=new $t(this['_univer'],_0x93a353),_0x372449=0x0;for(let [_0x5df49a,_0x440f5f]of _0x576a63['entries']()){let _0x11c461=performance['now']();_0x25e9c4['collect'](_0x440f5f),_0x372449+=performance['now']()-_0x11c461,this['_executeMutationBatch'](_0x8073a3,[_0x440f5f],_0x5df49a);}return{'requiredUnitPermissions':_0x25e9c4['finish'](),'permissionAnalysisDurationMs':_0x372449};}['_executeMutationBatch'](_0x2116fa,_0x415146,_0x39c26b=0x0){let _0x30d5dd=(0x0,u['sequenceExecute'])(_0x415146,this['_commandService'],{'fromChangeset':!0x0});if(_0x30d5dd['result'])return;let _0x96e205=_0x415146[_0x30d5dd['index']],_0x4674fb=_0x39c26b+_0x30d5dd['index'];throw new S('INTERNAL_ERROR','Unit\x20Runtime\x20failed\x20to\x20execute\x20mutation\x20\x22'+_0x96e205['id']+'\x22\x20for\x20Unit\x20\x22'+_0x2116fa['unitID']+'\x22\x20at\x20revision\x20'+_0x2116fa['revision']+'\x20(index\x20'+_0x4674fb+')',{'retryable':!0x0,'cause':_0x30d5dd['error']});}async['_restoreHistoricalRevision'](_0x1d2a5f,_0x428d9a,_0x4ee3ce,_0x2facde){let _0x4d0cc2=await this['_database'](()=>this['_reader']['getSnapshot'](_0x1d2a5f,_0x428d9a['unitID'],{'revision':_0x2facde}));if(!_0x4d0cc2||_0x4d0cc2['unitID']!==_0x428d9a['unitID']||_0x4d0cc2['type']!==_0x428d9a['type']||!Number['isSafeInteger'](_0x4d0cc2['rev'])||_0x4d0cc2['rev']<0x1||_0x4d0cc2['rev']>_0x2facde)throw new S('ADAPTER_FAILURE','Stored\x20restore\x20snapshot\x20is\x20invalid',{'retryable':!0x0});this['_instanceService']['disposeUnit'](_0x428d9a['unitID']),await this['_loadSdkUnit'](_0x1d2a5f,_0x428d9a['unitID'],_0x428d9a['type'],_0x4d0cc2['rev'],_0x4d0cc2);let _0x4eb3f6=new bn(_0x428d9a['unitID'],_0x428d9a['type'],_0x4d0cc2['rev']);if(_0x4eb3f6['revision']<_0x2facde&&await this['_replayRange'](_0x1d2a5f,_0x4eb3f6,_0x4eb3f6['revision'],_0x2facde),_0x4eb3f6['revision']!==_0x2facde)throw new S('ADAPTER_FAILURE','Restore\x20history\x20did\x20not\x20reach\x20its\x20target\x20revision',{'retryable':!0x0});if(this['_revisionService']['setRevOfUnit'](_0x428d9a['unitID'],_0x4ee3ce['revision']),this['_revisionService']['getCurrentRevOfUnit'](_0x428d9a['unitID'])!==_0x4ee3ce['revision'])throw Error('Univer\x20Runtime\x20did\x20not\x20adopt\x20the\x20restored\x20revision');_0x428d9a['advanceTo'](_0x4ee3ce['revision']);}['_requireEntry'](_0x3aa51a){let _0x5b4f22=this['_entries']['get'](_0x3aa51a['unitID']);if(!_0x5b4f22||_0x5b4f22['handle']!==_0x3aa51a||_0x5b4f22['handle']['type']!==_0x3aa51a['type'])throw new S('INTERNAL_ERROR','Unit\x20Runtime\x20handle\x20is\x20stale',{'retryable':!0x0});return _0x5b4f22;}async['_withBusy'](_0x5d1ae6,_0x508f8a,_0x33744a=!0x0){_0x5d1ae6['busy']+=0x1,_0x5d1ae6['idleTimer']&&(clearTimeout(_0x5d1ae6['idleTimer']),delete _0x5d1ae6['idleTimer']);try{return await _0x508f8a();}finally{--_0x5d1ae6['busy'],_0x33744a&&this['_entries']['get'](_0x5d1ae6['handle']['unitID'])===_0x5d1ae6&&(this['_touch'](_0x5d1ae6),this['_evictOverCapacity']());}}['_retain'](_0x501e3d){let _0x5c1d06=this['_entries']['get'](_0x501e3d['unitID']);if(!_0x5c1d06||_0x5c1d06['handle']!==_0x501e3d)throw new S('INTERNAL_ERROR','Unit\x20Runtime\x20was\x20disposed\x20before\x20its\x20lease\x20could\x20be\x20acquired',{'retryable':!0x0});return _0x5c1d06['busy']+=0x1,this['_touch'](_0x5c1d06),this['_evictOverCapacity'](),_0x501e3d;}['_adoptReservation'](_0xf65d70){let _0x41b63c=this['_entries']['get'](_0xf65d70['unitID']);if(!_0x41b63c||_0x41b63c['handle']!==_0xf65d70||_0x41b63c['busy']<0x1)throw new S('INTERNAL_ERROR','Unit\x20Runtime\x20load\x20reservation\x20is\x20unavailable',{'retryable':!0x0});return this['_touch'](_0x41b63c),this['_evictOverCapacity'](),_0xf65d70;}['_touch'](_0x45fa6c){let {unitID:_0x2a3dbd}=_0x45fa6c['handle'];if(_0x45fa6c['idleTimer']&&clearTimeout(_0x45fa6c['idleTimer']),this['_entries']['delete'](_0x2a3dbd),this['_entries']['set'](_0x2a3dbd,_0x45fa6c),_0x45fa6c['busy']>0x0){delete _0x45fa6c['idleTimer'];return;}_0x45fa6c['idleTimer']=setTimeout(()=>{_0x45fa6c['busy']===0x0&&this['_entries']['get'](_0x2a3dbd)===_0x45fa6c&&this['disposeUnit'](_0x2a3dbd);},this['_idleTimeoutMs']),_0x45fa6c['idleTimer']['unref']?.();}['_evictOverCapacity'](){for(;this['_entries']['size']>this['_maxLoadedUnits'];){let _0x2a1620=[...this['_entries']['values']()]['find'](_0x3db3fa=>_0x3db3fa['busy']===0x0);if(!_0x2a1620)return;this['disposeUnit'](_0x2a1620['handle']['unitID']);}}async['_database'](_0xdca905){try{return await _0xdca905();}catch(_0x1e61d2){throw _0x1e61d2 instanceof S?_0x1e61d2:new S('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x1e61d2});}}['_assertOpen'](){if(this['_disposed'])throw new S('INTERNAL_ERROR','Unit\x20Runtime\x20is\x20disposed',{'retryable':!0x0});}};function xn(_0x395e6f,_0x23f0f8){if(!_0x395e6f)throw new S('INVALID_REQUEST','unitID\x20is\x20required');if(!Sn['has'](_0x23f0f8))throw new S('INVALID_REQUEST','Unsupported\x20Unit\x20type:\x20'+_0x23f0f8);}var Sn=new Set([c['UniverType']['UNIVER_SHEET'],c['UniverType']['UNIVER_DOC'],c['UniverType']['UNIVER_SLIDE'],c['UniverType']['UNIVER_BOARD'],c['UniverType']['UNIVER_BASE']]),Cn=class{['_options'];constructor(_0x254302){this['_options']=_0x254302;}async['submit'](_0x111724,_0x5c2c06){let _0x20e273=_0x5c2c06['changeset'];wn(_0x20e273);let _0x11190b={..._0x111724,'request':_0x5c2c06};try{return await this['_options']['coordinator']['runExclusive'](_0x20e273['unitID'],async()=>{let _0x2f6c17=this['_options']['maxRevisionRetries']+0x1;for(let _0x371c7c=0x1;_0x371c7c<=_0x2f6c17;_0x371c7c+=0x1){let _0x119d61=await this['_attempt'](_0x11190b,_0x111724,_0x5c2c06,_0x20e273,_0x371c7c);if(_0x119d61['status']!=='retry-attempt')return _0x119d61;}throw this['_options']['runtime']['disposeUnit'](_0x20e273['unitID']),new S('REVISION_MISMATCH','Changeset\x20could\x20not\x20be\x20committed\x20after\x20bounded\x20retries',{'retryable':!0x0});});}catch(_0x3d5424){throw _0x3d5424 instanceof S&&_0x3d5424['code']==='UNIT_NOT_FOUND'&&this['_options']['runtime']['disposeUnit'](_0x20e273['unitID']),_0x3d5424;}}async['_attempt'](_0x38135d,_0x404107,_0x254bb2,_0x45a25f,_0x2bfc5d){let _0x3323a0=await this['_measure']('load',()=>this['_options']['runtime']['ensureUnit'](_0x38135d,_0x45a25f['unitID'],_0x45a25f['type']));try{let _0x2981da=_0x3323a0['revision'];if(_0x45a25f['baseRev']>_0x2981da)throw new S('REVISION_MISMATCH','Changeset\x20base\x20revision\x20is\x20ahead\x20of\x20the\x20Unit\x20head');let _0xe868fd=await this['_getHistory'](_0x38135d,_0x45a25f['unitID'],_0x45a25f['type'],_0x45a25f['baseRev'],_0x2981da),_0x5a42c1=En(_0xe868fd,_0x45a25f);if(_0x5a42c1)return q(_0x5a42c1,_0x45a25f),J(_0x5a42c1)&&await this['_ensureRestoreSnapshot'](_0x38135d,_0x3323a0,_0x5a42c1)?(await this['_options']['onCommitted'](_0x404107,_0x254bb2,_0x5a42c1,[]),{'status':'committed','changeset':_0x5a42c1}):{'status':'already-committed','changeset':_0x5a42c1};let _0x4ae9cd=await this['_measure']('transform',async()=>this['_createCandidate'](_0x45a25f,_0xe868fd,_0x2981da)),_0x2724d9=[],_0x1f1bd8=!0x1;try{let _0x3b99eb={'userID':_0x404107['userID'],'memberID':_0x404107['memberID'],'customData':_0x404107['customData'],'request':_0x254bb2,'attempt':_0x2bfc5d,'currentRevision':_0x2981da,'changeset':_0x4ae9cd};await this['_measure']('applyMiddleware',()=>this['_options']['middleware']['run']('applyChangeset',_0x3b99eb,async()=>{let _0x20e637=await this['_measure']('executeMutations',()=>this['_options']['runtime']['applyChangeset'](_0x38135d,_0x3323a0,_0x4ae9cd,{'collectUnitPermissions':this['_options']['enableUnitPermissionAnalysis']===!0x0}));_0x2724d9=_0x20e637['requiredUnitPermissions'];let _0x152b6b=_0x20e637['permissionAnalysisDurationMs'];_0x152b6b!==void 0x0&&this['_options']['metrics']['observe']('collaboration.submit.duration',_0x152b6b,{'stage':'unitPermissionAnalysis'}),_0x1f1bd8=!0x0;}));let _0x5059e2=await this['_runCommitMiddleware'](_0x38135d,_0x404107,_0x254bb2,_0x4ae9cd,_0x2bfc5d,_0x2981da,_0x2724d9);if(!_0x5059e2)return this['_options']['runtime']['disposeUnit'](_0x45a25f['unitID']),{'status':'retry-attempt'};switch(_0x5059e2['status']){case'revision-mismatch':if(!Number['isSafeInteger'](_0x5059e2['actualHeadRevision'])||_0x5059e2['actualHeadRevision']<0x1)throw X('Database\x20returned\x20an\x20invalid\x20head\x20revision\x20mismatch');return this['_options']['runtime']['disposeUnit'](_0x45a25f['unitID']),this['_options']['metrics']['increment']('collaboration.submit.retry',{'reason':'revision-mismatch'}),{'status':'retry-attempt'};case'recovered-committed':return J(_0x5059e2['changeset'])?(await this['_ensureRestoreSnapshot'](_0x38135d,_0x3323a0,_0x5059e2['changeset']),await this['_options']['onCommitted'](_0x404107,_0x254bb2,_0x5059e2['changeset'],_0x2724d9),{'status':'committed','changeset':_0x5059e2['changeset']}):(this['_options']['runtime']['disposeUnit'](_0x45a25f['unitID']),await this['_options']['onCommitted'](_0x404107,_0x254bb2,_0x5059e2['changeset'],_0x2724d9),await this['_snapshotBestEffort'](_0x38135d,void 0x0,_0x5059e2['changeset']),{'status':'committed','changeset':_0x5059e2['changeset']});case'committed':return q(_0x5059e2['changeset'],_0x4ae9cd,!0x0),J(_0x5059e2['changeset'])?(await this['_ensureRestoreSnapshot'](_0x38135d,_0x3323a0,_0x5059e2['changeset']),await this['_options']['onCommitted'](_0x404107,_0x254bb2,_0x5059e2['changeset'],_0x2724d9),{'status':'committed','changeset':_0x5059e2['changeset']}):(await this['_options']['onCommitted'](_0x404107,_0x254bb2,_0x5059e2['changeset'],_0x2724d9),await this['_snapshotBestEffort'](_0x38135d,_0x3323a0,_0x5059e2['changeset']),{'status':'committed','changeset':_0x5059e2['changeset']});}}catch(_0x411b40){throw _0x1f1bd8&&this['_options']['runtime']['disposeUnit'](_0x45a25f['unitID']),_0x411b40;}}finally{this['_options']['runtime']['releaseUnit'](_0x3323a0);}}async['_runCommitMiddleware'](_0x181fc7,_0xb255df,_0x268476,_0x849ac0,_0x1095dd,_0x12c70b,_0xc93de0){let _0x454cc6,_0x4dbbc9,_0x37ff5a={'userID':_0xb255df['userID'],'memberID':_0xb255df['memberID'],'customData':_0xb255df['customData'],'request':_0x268476,'attempt':_0x1095dd,'expectedHeadRevision':_0x12c70b,'changeset':_0x849ac0,'requiredUnitPermissions':_0xc93de0};try{await this['_measure']('commitMiddleware',()=>this['_options']['middleware']['run']('commitChangeset',_0x37ff5a,async()=>{try{_0x454cc6=await this['_measure']('databaseCommit',()=>this['_database'](()=>this['_options']['dbAdapter']['commitChangeset'](_0x181fc7,{'changeset':_0x849ac0})));}catch(_0x16a063){throw _0x4dbbc9=_0x16a063,_0x16a063;}}));}catch(_0x5cc163){if(_0x454cc6)return this['_options']['logger']['error']('commitChangeset\x20middleware\x20failed\x20after\x20database\x20commit',{'error':On(_0x5cc163)}),_0x454cc6;if(!_0x4dbbc9)throw _0x5cc163;if(_0x4dbbc9 instanceof S&&!_0x4dbbc9['retryable'])throw _0x4dbbc9;}if(_0x454cc6)return _0x454cc6;let _0x154ce4=En(await this['_getHistoryToLatest'](_0x181fc7,_0x849ac0['unitID'],_0x849ac0['type'],_0x12c70b),_0x849ac0);return _0x154ce4?(q(_0x154ce4,_0x849ac0),{'status':'recovered-committed','changeset':_0x154ce4}):(this['_options']['metrics']['increment']('collaboration.submit.retry',{'reason':'unknown-commit'}),null);}async['_getHistory'](_0x2e9201,_0x5ea9ee,_0x13e5b2,_0x2e4085,_0x1fe8d1){if(_0x2e4085===_0x1fe8d1)return[];let _0xcf3ee0=await this['_database'](()=>this['_options']['dbAdapter']['getChangesets'](_0x2e9201,_0x5ea9ee,{'from':_0x2e4085,'to':_0x1fe8d1}));if(_0xcf3ee0===null)throw X('Unit\x20is\x20unavailable\x20while\x20reading\x20changeset\x20history');let _0x27e2ce=_0x2e4085+0x1;for(let _0x41c182 of _0xcf3ee0){if(_0x41c182['unitID']!==_0x5ea9ee||_0x41c182['type']!==_0x13e5b2||_0x41c182['baseRev']!==_0x27e2ce-0x1||_0x41c182['revision']!==_0x27e2ce)throw X('Stored\x20changeset\x20history\x20is\x20not\x20contiguous');_0x27e2ce+=0x1;}if(_0x27e2ce-0x1!==_0x1fe8d1)throw X('Stored\x20changeset\x20history\x20is\x20incomplete');return _0xcf3ee0;}async['_getHistoryToLatest'](_0x175bf3,_0xe38f4f,_0x14ccd9,_0x5c8cbf){let _0x12c709=await this['_database'](()=>this['_options']['dbAdapter']['getChangesets'](_0x175bf3,_0xe38f4f,{'from':_0x5c8cbf}));if(_0x12c709===null)throw X('Unit\x20is\x20unavailable\x20while\x20reading\x20changeset\x20history');let _0x571ea6=_0x5c8cbf+0x1;for(let _0x4e19ad of _0x12c709){if(_0x4e19ad['unitID']!==_0xe38f4f||_0x4e19ad['type']!==_0x14ccd9||_0x4e19ad['baseRev']!==_0x571ea6-0x1||_0x4e19ad['revision']!==_0x571ea6)throw X('Stored\x20changeset\x20history\x20is\x20not\x20contiguous');_0x571ea6+=0x1;}return _0x12c709;}['_createCandidate'](_0x2f5902,_0x4a22b5,_0x5e73c8){let _0x51fbb5=this['_options']['transformer']['parseClient'](_0x2f5902);return{...this['_options']['transformer']['transform'](_0x51fbb5,_0x4a22b5),'unitID':_0x2f5902['unitID'],'type':_0x2f5902['type'],'baseRev':_0x5e73c8,'revision':_0x5e73c8+0x1,'sid':_0x2f5902['sid'],'reqId':_0x2f5902['reqId']};}async['_snapshotBestEffort'](_0xd572b2,_0x4e557b,_0x5a200e){let _0x47b0e8=this['_options']['snapshotPolicy'];if(!_0x47b0e8)return;let _0x2d8aa8;try{await this['_measure']('snapshot',async()=>{let _0x4b8d5b=await this['_database'](()=>this['_options']['dbAdapter']['getSnapshotInfo'](_0xd572b2,_0x5a200e['unitID']));if(!_0x4b8d5b||_0x4b8d5b['unitID']!==_0x5a200e['unitID']||_0x4b8d5b['type']!==_0x5a200e['type']||!Number['isSafeInteger'](_0x4b8d5b['rev'])||_0x4b8d5b['rev']<0x1)throw X('Database\x20returned\x20invalid\x20latest\x20snapshot\x20info');if(_0x4b8d5b['rev']>=_0x5a200e['revision'])return;let _0x31884a=_0x5a200e['revision']-_0x4b8d5b['rev'];if(!J(_0x5a200e)&&!_0x47b0e8['shouldCreate']({'unitID':_0x5a200e['unitID'],'type':_0x5a200e['type'],'revision':_0x5a200e['revision'],'changesetBytes':Dn(_0x5a200e),'revisionsSinceLastSnapshot':_0x31884a}))return;let _0x1fa886=_0x4e557b??(_0x2d8aa8=await this['_options']['runtime']['ensureUnit'](_0xd572b2,_0x5a200e['unitID'],_0x5a200e['type'])),_0x26ed32=await this['_options']['runtime']['createSnapshot'](_0x1fa886);await this['_database'](()=>this['_options']['dbAdapter']['saveSnapshot'](_0xd572b2,_0x26ed32));});}catch(_0x43ce58){_0x43ce58 instanceof S&&_0x43ce58['code']==='UNIT_NOT_FOUND'&&this['_options']['runtime']['disposeUnit'](_0x5a200e['unitID']),this['_options']['metrics']['increment']('collaboration.snapshot.failure'),this['_options']['logger']['warn']('Best-effort\x20snapshot\x20failed',{'unitID':_0x5a200e['unitID'],'revision':_0x5a200e['revision'],'error':On(_0x43ce58)});}finally{_0x2d8aa8&&this['_options']['runtime']['releaseUnit'](_0x2d8aa8);}}async['_ensureRestoreSnapshot'](_0x2f4ee0,_0x2f3c7a,_0x2c13f6){let _0x495fc2;try{return await this['_measure']('restoreSnapshot',async()=>{if((await this['_getValidatedSnapshot'](_0x2f4ee0,_0x2c13f6))['rev']===_0x2c13f6['revision'])return!0x1;let _0x5ca815=_0x2f3c7a??(_0x495fc2=await this['_options']['runtime']['ensureUnit'](_0x2f4ee0,_0x2c13f6['unitID'],_0x2c13f6['type']));if(_0x5ca815['revision']!==_0x2c13f6['revision'])throw X('Unit\x20Runtime\x20is\x20not\x20at\x20the\x20committed\x20restore\x20revision');let _0x34e751=await this['_options']['runtime']['createSnapshot'](_0x5ca815);if(_0x34e751['snapshot']['unitID']!==_0x2c13f6['unitID']||_0x34e751['snapshot']['type']!==_0x2c13f6['type']||_0x34e751['snapshot']['rev']!==_0x2c13f6['revision'])throw X('Unit\x20Runtime\x20returned\x20an\x20invalid\x20restore\x20snapshot');try{await this['_database'](()=>this['_options']['dbAdapter']['saveSnapshot'](_0x2f4ee0,_0x34e751));}catch(_0x599667){if((await this['_getValidatedSnapshot'](_0x2f4ee0,_0x2c13f6))['rev']!==_0x2c13f6['revision'])throw _0x599667;}return!0x0;});}catch(_0x14d59b){throw this['_options']['metrics']['increment']('collaboration.snapshot.failure',{'reason':'restore-required'}),this['_options']['logger']['warn']('Required\x20restore\x20snapshot\x20failed',{'unitID':_0x2c13f6['unitID'],'revision':_0x2c13f6['revision'],'error':On(_0x14d59b)}),_0x14d59b;}finally{_0x495fc2&&this['_options']['runtime']['releaseUnit'](_0x495fc2);}}async['_getValidatedSnapshot'](_0x122a0e,_0x2c6531){let _0x1ba069=await this['_database'](()=>this['_options']['dbAdapter']['getSnapshot'](_0x122a0e,_0x2c6531['unitID'],{'revision':_0x2c6531['revision']}));if(!_0x1ba069||_0x1ba069['unitID']!==_0x2c6531['unitID']||_0x1ba069['type']!==_0x2c6531['type']||!Number['isSafeInteger'](_0x1ba069['rev'])||_0x1ba069['rev']<0x1||_0x1ba069['rev']>_0x2c6531['revision'])throw X('Database\x20returned\x20an\x20invalid\x20nearest\x20snapshot');return _0x1ba069;}async['_database'](_0x4260e4){try{return await _0x4260e4();}catch(_0x40892e){throw _0x40892e instanceof S?_0x40892e:new S('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x40892e});}}async['_measure'](_0x1dae75,_0x4f14bb){let _0x8b7b1f=performance['now']();try{return await _0x4f14bb();}finally{this['_options']['metrics']['observe']('collaboration.submit.duration',performance['now']()-_0x8b7b1f,{'stage':_0x1dae75});}}};function wn(_0x276baf){if(!_0x276baf['unitID'])throw Y('unitID\x20is\x20required');if(!Tn['has'](_0x276baf['type']))throw Y('Unsupported\x20Unit\x20type');if(!Number['isSafeInteger'](_0x276baf['baseRev'])||_0x276baf['baseRev']<0x1)throw Y('baseRev\x20must\x20be\x20a\x20positive\x20safe\x20integer');if(!_0x276baf['sid'])throw Y('sid\x20is\x20required');if(!Number['isSafeInteger'](_0x276baf['reqId'])||_0x276baf['reqId']<0x1)throw Y('reqId\x20must\x20be\x20a\x20positive\x20safe\x20integer');if(!Array['isArray'](_0x276baf['mutations']))throw Y('changeset\x20mutations\x20must\x20be\x20an\x20array');}var Tn=new Set([c['UniverType']['UNIVER_SHEET'],c['UniverType']['UNIVER_DOC'],c['UniverType']['UNIVER_SLIDE'],c['UniverType']['UNIVER_BOARD'],c['UniverType']['UNIVER_BASE']]);function q(_0x68ef6e,_0x58af14,_0x3023ac=!0x1){if(_0x68ef6e['unitID']!==_0x58af14['unitID']||_0x68ef6e['type']!==_0x58af14['type']||_0x68ef6e['sid']!==_0x58af14['sid']||_0x68ef6e['reqId']!==_0x58af14['reqId']||!Number['isSafeInteger'](_0x68ef6e['baseRev'])||_0x68ef6e['baseRev']<0x1||!Number['isSafeInteger'](_0x68ef6e['revision'])||_0x68ef6e['revision']!==_0x68ef6e['baseRev']+0x1||_0x3023ac&&(_0x68ef6e['baseRev']!==_0x58af14['baseRev']||_0x68ef6e['revision']!==_0x58af14['revision']||_0x68ef6e['userID']!==_0x58af14['userID']||_0x68ef6e['memberID']!==_0x58af14['memberID']))throw X('Database\x20returned\x20an\x20invalid\x20committed\x20changeset');}function En(_0x48b6b3,_0x24d8e2){return _0x48b6b3['find'](_0x32bef9=>_0x32bef9['sid']===_0x24d8e2['sid']&&_0x32bef9['reqId']===_0x24d8e2['reqId']);}function Dn(_0x4e0e34){try{return new TextEncoder()['encode'](JSON['stringify'](_0x4e0e34))['byteLength'];}catch{return _0x4e0e34['mutationSize']??0x0;}}function J(_0xf50adf){return _0xf50adf['mutations']['some'](_0x94c1dc=>_0x94c1dc['id']==='univer.mutation.revert-version');}function Y(_0x5c65c4){return new S('INVALID_REQUEST',_0x5c65c4);}function X(_0x423f79){return new S('ADAPTER_FAILURE',_0x423f79,{'retryable':!0x0});}function On(_0x1adee3){return _0x1adee3 instanceof Error?_0x1adee3['message']:String(_0x1adee3);}var kn=class{['_queues']=new Map();async['runExclusive'](_0x49c4f7,_0x5d551f){let _0x3d9750=this['_queues']['get'](_0x49c4f7)??{'tail':Promise['resolve'](),'pending':0x0};_0x3d9750['pending']+=0x1,this['_queues']['set'](_0x49c4f7,_0x3d9750);let _0x13e38c=_0x3d9750['tail'],_0x22769f;_0x3d9750['tail']=new Promise(_0x7dd75c=>{_0x22769f=_0x7dd75c;}),await _0x13e38c;try{return await _0x5d551f();}finally{_0x22769f(),--_0x3d9750['pending'],_0x3d9750['pending']===0x0&&this['_queues']['get'](_0x49c4f7)===_0x3d9750&&this['_queues']['delete'](_0x49c4f7);}}['runExclusiveMany'](_0x515c1c,_0x547a18){let _0xfe315=[...new Set(_0x515c1c)]['sort'](),_0x43300e=_0x449367=>{let _0x220893=_0xfe315[_0x449367];return _0x220893===void 0x0?_0x547a18():this['runExclusive'](_0x220893,()=>_0x43300e(_0x449367+0x1));};return _0x43300e(0x0);}},An=class{['_onListenerError'];['_listeners']=new Map();constructor(_0x2438cb){this['_onListenerError']=_0x2438cb;}['on'](_0x48c76e,_0x5dceb9){let _0x599cbb=this['_listeners']['get'](_0x48c76e)??[],_0x236a2e=_0x5dceb9;_0x599cbb['push'](_0x236a2e),this['_listeners']['set'](_0x48c76e,_0x599cbb);let _0x5a8b90=!0x1;return{'dispose':()=>{if(_0x5a8b90)return;_0x5a8b90=!0x0;let _0x400da5=_0x599cbb['indexOf'](_0x236a2e);_0x400da5>=0x0&&_0x599cbb['splice'](_0x400da5,0x1);}};}async['emit'](_0x3341a4,_0x5b5ca1){let _0x5f1e84=[...this['_listeners']['get'](_0x3341a4)??[]];for(let _0x565c42 of _0x5f1e84)try{await _0x565c42(_0x5b5ca1);}catch(_0x787ec9){try{this['_onListenerError'](_0x787ec9);}catch{}}}['clear'](){this['_listeners']['clear']();}},jn=class{['_owner'];['_state']='running';['_activeCalls']=0x0;['_drainPromise'];['_resolveDrain'];['_disposePromise'];constructor(_0x100bd2){this['_owner']=_0x100bd2;}get['state'](){return this['_state'];}['run'](_0x3b41a2){return this['_state']==='running'?(this['_activeCalls']+=0x1,Promise['resolve']()['then'](_0x3b41a2)['finally'](()=>{--this['_activeCalls'],this['_activeCalls']===0x0&&(this['_resolveDrain']?.(),this['_resolveDrain']=void 0x0,this['_drainPromise']=void 0x0);})):Promise['reject'](new S('INTERNAL_ERROR',this['_owner']+'\x20is\x20'+this['_state'],{'retryable':!0x0}));}['dispose'](_0x1f6d62){return this['_disposePromise']?this['_disposePromise']:(this['_state']='disposing',this['_disposePromise']=this['_finishDispose'](_0x1f6d62),this['_disposePromise']);}async['_finishDispose'](_0xa898ce){this['_activeCalls']>0x0&&(this['_drainPromise']=new Promise(_0x1a5de7=>{this['_resolveDrain']=_0x1a5de7;}),await this['_drainPromise']);try{await _0xa898ce();}finally{this['_state']='disposed';}}},Mn=new Set([c['UniverType']['UNIVER_SHEET'],c['UniverType']['UNIVER_DOC'],c['UniverType']['UNIVER_SLIDE'],c['UniverType']['UNIVER_BOARD'],c['UniverType']['UNIVER_BASE']]),Nn=0x64,Pn=class{['_dbAdapter'];['_middleware']=new ze();['_lifecycle']=new jn('Collaboration\x20Service');['_logger'];['_metrics'];['_events'];['_runtime'];['_coordinator'];['_submitEngine'];constructor(_0x3a7f4e){if(!_0x3a7f4e?.['dbAdapter'])throw TypeError('UniverCollabService\x20requires\x20a\x20dbAdapter');this['_dbAdapter']=_0x3a7f4e['dbAdapter'],this['_logger']=He(_0x3a7f4e['logger']),this['_metrics']=Ue(_0x3a7f4e['metrics']),this['_events']=new An(_0x50d41a=>{this['_logger']['error']('Collaboration\x20Service\x20event\x20listener\x20failed',{'error':Un(_0x50d41a)});});let _0x227b44=_0x3a7f4e['submitChangeset']?.['maxRevisionRetries']??0x3;if(!Number['isSafeInteger'](_0x227b44)||_0x227b44<0x0)throw TypeError('submitChangeset.maxRevisionRetries\x20must\x20be\x20a\x20non-negative\x20safe\x20integer');this['_runtime']=new K({'reader':this['_dbAdapter'],..._0x3a7f4e['runtime']?.['maxLoadedUnits']===void 0x0?{}:{'maxLoadedUnits':_0x3a7f4e['runtime']['maxLoadedUnits']},..._0x3a7f4e['runtime']?.['idleTimeoutMs']===void 0x0?{}:{'idleTimeoutMs':_0x3a7f4e['runtime']['idleTimeoutMs']}}),this['_coordinator']=new kn(),this['_submitEngine']=new Cn({'dbAdapter':this['_dbAdapter'],'middleware':this['_middleware'],'runtime':this['_runtime'],'transformer':this['_runtime']['changesetTransformer'],'coordinator':this['_coordinator'],..._0x3a7f4e['snapshotPolicy']===!0x1?{}:{'snapshotPolicy':_0x3a7f4e['snapshotPolicy']??Ie},'enableUnitPermissionAnalysis':_0x3a7f4e['enableUnitPermissionAnalysis']??!0x1,'maxRevisionRetries':_0x227b44,'logger':this['_logger'],'metrics':this['_metrics'],'onCommitted':(_0x320b0c,_0xc586d5,_0x2550ec,_0x58267a)=>this['_events']['emit']('changesetCommitted',{'userID':_0x320b0c['userID'],'memberID':_0x320b0c['memberID'],'customData':_0x320b0c['customData'],'request':_0xc586d5,'changeset':_0x2550ec,'requiredUnitPermissions':_0x58267a,'committedAt':Date['now']()})});}get['dbAdapter'](){return this['_dbAdapter'];}['use'](_0x166934,_0x5654af){return this['_assertRunning'](),this['_middleware']['use'](_0x166934,_0x5654af);}['on'](_0x5e296,_0x2476c2){return this['_assertRunning'](),this['_events']['on'](_0x5e296,_0x2476c2);}['getUnitLoadData'](_0x535928,_0x36fdb1){return this['_call']('getUnitLoadData',async()=>{let _0xa9682=C(_0x36fdb1),_0x1f3f6b=We(_0x535928),_0x253ed4={..._0xa9682,'request':_0x1f3f6b},_0x5a07fa;return await this['_middleware']['run']('readUnitData',_0x253ed4,async()=>{_0x5a07fa=await this['_getUnitLoadData'](_0x253ed4,_0x535928);}),_0x5a07fa;});}['getUnitLoadDataWithBlocks'](_0x129e71,_0x26fa73){return this['_call']('getUnitLoadDataWithBlocks',async()=>{let _0x3559d8=C(_0x26fa73),_0x1473e3=We(_0x129e71),_0x56c006={..._0x3559d8,'request':_0x1473e3},_0x3fe9ae;return await this['_middleware']['run']('readUnitData',_0x56c006,async()=>{let _0x3f5125=await this['_getUnitLoadData'](_0x56c006,_0x129e71),_0x5b98fb=await this['_getSnapshotSheetBlocks'](_0x56c006,_0x3f5125['snapshot']);_0x3fe9ae={..._0x3f5125,'sheetBlocks':_0x5b98fb};}),_0x3fe9ae;});}['getChangesets'](_0x4910d6,_0x4b534c){return this['_call']('getChangesets',async()=>{let _0x5e88a1=C(_0x4b534c),_0x173bea=Ge(_0x4910d6),_0x5529cb={..._0x5e88a1,'request':_0x173bea},_0x50d3cb;return await this['_middleware']['run']('readUnitData',_0x5529cb,async()=>{Z(_0x4910d6['unitID'],_0x4910d6['type']),zn('from',_0x4910d6['from']),zn('to',_0x4910d6['to']);let _0x441f48=await this['_requireUnit'](_0x5529cb,_0x4910d6['unitID'],_0x4910d6['type']),_0x237b77=_0x4910d6['to']===0x0?void 0x0:Bn(_0x4910d6['to'],_0x441f48);if(_0x4910d6['from']>(_0x237b77??_0x441f48['headRevision']))throw Q('Changeset\x20range\x20starts\x20after\x20its\x20target');let _0x1f93be=await this['_database'](()=>this['_dbAdapter']['getChangesets'](_0x5529cb,_0x4910d6['unitID'],{'from':_0x4910d6['from'],..._0x237b77===void 0x0?{}:{'to':_0x237b77}}));if(_0x1f93be===null)throw new S('UNIT_NOT_FOUND','Unit\x20'+_0x4910d6['unitID']+'\x20does\x20not\x20exist');Vn(_0x1f93be,_0x4910d6['unitID'],_0x4910d6['type'],Math['max'](_0x4910d6['from']+0x1,0x2),_0x237b77),_0x50d3cb={'changesets':_0x1f93be};}),_0x50d3cb;});}['getSheetBlock'](_0x1623d5,_0x1453d6){return this['_call']('getSheetBlock',async()=>{let _0x3a4885=C(_0x1453d6),_0x157db8=Ke(_0x1623d5),_0x4395de={..._0x3a4885,'request':_0x157db8},_0x34e952;return await this['_middleware']['run']('readUnitData',_0x4395de,async()=>{if(Z(_0x1623d5['unitID'],_0x1623d5['type']),!_0x1623d5['blockID'])throw Q('blockID\x20is\x20required');await this['_requireUnit'](_0x4395de,_0x1623d5['unitID'],_0x1623d5['type']),_0x34e952={'block':await this['_database'](()=>this['_dbAdapter']['getSheetBlock'](_0x4395de,_0x1623d5['unitID'],_0x1623d5['blockID']))};}),_0x34e952;});}['createUnitFromSnapshot'](_0xff8aaf,_0x5a23c6){return this['_call']('createUnitFromSnapshot',()=>this['_createUnit'](_0xff8aaf,C(_0x5a23c6)));}['createUnitFromData'](_0x18b7f1,_0x3cfb82){return this['_call']('createUnitFromData',async()=>{if(!_0x18b7f1||!Mn['has'](_0x18b7f1['type']))throw Q('Unsupported\x20unit\x20type');if(!_0x18b7f1['data']?.['id'])throw Q('data.id\x20is\x20required');if(_0x18b7f1['data']['rev']!==0x1)throw Q('Initial\x20Unit\x20data\x20revision\x20must\x20be\x201');let _0x329e02=C(_0x3cfb82),_0x2fb283=await Ze(_0x18b7f1);return this['_createUnit'](_0x2fb283,_0x329e02);});}['deleteUnits'](_0xc6fe56,_0x203cc1){return this['_call']('deleteUnits',async()=>{let _0x58fdfa=C(_0x203cc1),_0xfd5856=Fn(_0xc6fe56?.['unitIDs']);if(_0xc6fe56['hardDelete']!==void 0x0&&typeof _0xc6fe56['hardDelete']!='boolean')throw Q('hardDelete\x20must\x20be\x20a\x20boolean');let _0x284c6e=Je({'unitIDs':_0xfd5856,'hardDelete':_0xc6fe56['hardDelete']??!0x1}),_0x2323a8={..._0x58fdfa,'request':_0x284c6e},_0x4bc463;return await this['_coordinator']['runExclusiveMany'](_0xfd5856,()=>this['_middleware']['run']('deleteUnits',_0x2323a8,async()=>{let _0x3b577d=await this['_database'](()=>this['_dbAdapter']['deleteUnits'](_0x2323a8,{'unitIDs':_0xfd5856,'hardDelete':_0x284c6e['hardDelete']}));for(let _0x1f2225 of _0xfd5856)this['_runtime']['disposeUnit'](_0x1f2225);In(_0x3b577d,_0xfd5856,_0x284c6e['hardDelete']),_0x4bc463=_0x3b577d,await this['_events']['emit']('unitsDeleted',{'userID':_0x58fdfa['userID'],'customData':_0x58fdfa['customData'],'request':_0x284c6e,'result':_0x3b577d,'deletedAt':Date['now']()});})),_0x4bc463;});}['recoverUnits'](_0x5bad80,_0x52e472){return this['_call']('recoverUnits',async()=>{let _0x1bc34b=C(_0x52e472),_0x339d10=Fn(_0x5bad80?.['unitIDs']),_0x837ae8=Ye({'unitIDs':_0x339d10}),_0x34a9c3={..._0x1bc34b,'request':_0x837ae8},_0x10e265;return await this['_coordinator']['runExclusiveMany'](_0x339d10,()=>this['_middleware']['run']('recoverUnits',_0x34a9c3,async()=>{let _0x545975=await this['_database'](()=>this['_dbAdapter']['recoverUnits'](_0x34a9c3,{'unitIDs':_0x339d10}));Ln(_0x545975,_0x339d10),_0x10e265=_0x545975,await this['_events']['emit']('unitsRecovered',{'userID':_0x1bc34b['userID'],'customData':_0x1bc34b['customData'],'request':_0x837ae8,'result':_0x545975,'recoveredAt':Date['now']()});})),_0x10e265;});}async['submitChangeset'](_0x322afe,_0x4c985b){try{return await this['_lifecycle']['run'](async()=>{let _0x4a9269=Le(_0x4c985b),_0x10867d=Xe(_0x322afe,_0x4a9269);_0x10867d['changeset']['createTime']??=Math['floor'](Date['now']()/0x3e8);let _0x3680f5={..._0x4a9269,'request':_0x10867d},_0x1d535d;return await this['_middleware']['run']('submitChangeset',_0x3680f5,async()=>{_0x1d535d=await this['_submitEngine']['submit'](_0x3680f5,_0x10867d);}),_0x1d535d;});}catch(_0x1505f3){let _0x541157=this['_normalizeError']('submitChangeset',_0x1505f3);return{'status':_0x541157['retryable']?'retry':'rejected','error':_0x541157};}}['dispose'](){return this['_lifecycle']['dispose'](async()=>{this['_middleware']['clear'](),this['_events']['clear'](),await this['_runtime']['dispose']();});}async['_getUnitLoadData'](_0x287531,_0x276b4e){Z(_0x276b4e['unitID'],_0x276b4e['type']),zn('revision',_0x276b4e['revision']);let _0x378260=await this['_requireUnit'](_0x287531,_0x276b4e['unitID'],_0x276b4e['type']),_0x1e8c41=Bn(_0x276b4e['revision'],_0x378260),_0x643cde=await this['_database'](()=>this['_dbAdapter']['getSnapshot'](_0x287531,_0x276b4e['unitID'],{'revision':_0x1e8c41}));if(!_0x643cde)throw new S('ADAPTER_FAILURE','Database\x20returned\x20a\x20unit\x20without\x20a\x20recoverable\x20snapshot',{'retryable':!0x0});if(_0x643cde['unitID']!==_0x276b4e['unitID']||_0x643cde['type']!==_0x276b4e['type']||!Number['isSafeInteger'](_0x643cde['rev'])||_0x643cde['rev']<0x1||_0x643cde['rev']>_0x1e8c41)throw new S('ADAPTER_FAILURE','Database\x20returned\x20an\x20invalid\x20snapshot',{'retryable':!0x0});let _0x15a67d=await this['_database'](()=>this['_dbAdapter']['getChangesets'](_0x287531,_0x276b4e['unitID'],{'from':_0x643cde['rev'],'to':_0x1e8c41}));if(_0x15a67d===null)throw new S('UNIT_NOT_FOUND','Unit\x20'+_0x276b4e['unitID']+'\x20does\x20not\x20exist');return Vn(_0x15a67d,_0x276b4e['unitID'],_0x276b4e['type'],_0x643cde['rev']+0x1,_0x1e8c41),{'snapshot':_0x643cde,'changesets':_0x15a67d,'targetRevision':_0x1e8c41};}async['_getSnapshotSheetBlocks'](_0x40af33,_0x477c05){let _0x27d1a0=et(_0x477c05);return Promise['all'](_0x27d1a0['map'](async _0x1c1908=>{let _0x268712=await this['_database'](()=>this['_dbAdapter']['getSheetBlock'](_0x40af33,_0x477c05['unitID'],_0x1c1908));if(!_0x268712||_0x268712['id']!==_0x1c1908)throw Hn('Database\x20returned\x20an\x20invalid\x20referenced\x20Sheet\x20block\x20'+_0x1c1908);return _0x268712;}));}async['_createUnit'](_0x235bae,_0x22e0d6){let _0xd6368a=qe(_0x235bae),_0x7a1451={..._0x22e0d6,'request':_0xd6368a},_0x1f7e66,{snapshot:_0x3037b7}=_0x235bae;return await this['_coordinator']['runExclusive'](_0x3037b7['unitID'],()=>this['_middleware']['run']('createUnit',_0x7a1451,async()=>{if(Z(_0x3037b7['unitID'],_0x3037b7['type']),_0x3037b7['rev']!==0x1)throw Q('Initial\x20snapshot\x20revision\x20must\x20be\x201');let _0x57e20d=await this['_database'](()=>this['_dbAdapter']['createUnit'](_0x7a1451,{'record':{'unitID':_0x3037b7['unitID'],'type':_0x3037b7['type'],'headRevision':0x1,'creatorID':_0x22e0d6['userID'],'createdAt':Date['now']()},'snapshot':_0x3037b7,..._0x235bae['sheetBlocks']===void 0x0?{}:{'sheetBlocks':_0x235bae['sheetBlocks']}}));if(_0x57e20d['record']['unitID']!==_0x3037b7['unitID']||_0x57e20d['record']['type']!==_0x3037b7['type']||!Number['isSafeInteger'](_0x57e20d['record']['headRevision'])||_0x57e20d['record']['headRevision']<0x1)throw new S('ADAPTER_FAILURE','Database\x20returned\x20an\x20invalid\x20created\x20unit\x20record',{'retryable':!0x0});_0x1f7e66={'status':_0x57e20d['status'],'unitID':_0x57e20d['record']['unitID'],'headRevision':_0x57e20d['record']['headRevision']},_0x57e20d['status']==='created'&&await this['_events']['emit']('unitCreated',{'userID':_0x22e0d6['userID'],'customData':_0x22e0d6['customData'],'request':_0xd6368a,'record':_0x57e20d['record'],'createdAt':Date['now']()});})),_0x1f7e66;}async['_requireUnit'](_0x5dcf2b,_0x244b1b,_0x18934f){let _0x4e5d64=await this['_database'](()=>this['_dbAdapter']['getUnit'](_0x5dcf2b,_0x244b1b));if(!_0x4e5d64)throw new S('UNIT_NOT_FOUND','Unit\x20'+_0x244b1b+'\x20does\x20not\x20exist');if(_0x4e5d64['unitID']!==_0x244b1b)throw new S('ADAPTER_FAILURE','Database\x20returned\x20Unit\x20metadata\x20for\x20a\x20different\x20identity',{'retryable':!0x0});if(_0x4e5d64['type']!==_0x18934f)throw Q('Unit\x20type\x20does\x20not\x20match\x20the\x20stored\x20unit');if(!Number['isSafeInteger'](_0x4e5d64['headRevision'])||_0x4e5d64['headRevision']<0x1)throw new S('ADAPTER_FAILURE','Database\x20returned\x20an\x20invalid\x20unit\x20head\x20revision',{'retryable':!0x0});return _0x4e5d64;}async['_database'](_0x3a4c35){try{return await _0x3a4c35();}catch(_0x22cd88){throw _0x22cd88 instanceof S?_0x22cd88:new S('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x22cd88});}}async['_call'](_0x5f38bd,_0x3b34d0){try{return this['_metrics']['increment']('collaboration.service.call',{'operation':_0x5f38bd}),await this['_lifecycle']['run'](_0x3b34d0);}catch(_0x3202da){throw this['_normalizeError'](_0x5f38bd,_0x3202da);}}['_normalizeError'](_0x3f0eae,_0x549a48){return _0x549a48 instanceof S?_0x549a48:(this['_logger']['error']('Collaboration\x20Service\x20operation\x20failed',{'operation':_0x3f0eae,'error':Un(_0x549a48)}),new S('INTERNAL_ERROR','Collaboration\x20Service\x20failed',{'retryable':!0x0,'cause':_0x549a48}));}['_assertRunning'](){if(this['_lifecycle']['state']!=='running')throw new S('INTERNAL_ERROR','Collaboration\x20Service\x20is\x20'+this['_lifecycle']['state'],{'retryable':!0x0});}};function Z(_0x47b69d,_0x47fcc1){if(!_0x47b69d)throw Q('unitID\x20is\x20required');if(!Mn['has'](_0x47fcc1))throw Q('Unsupported\x20unit\x20type');}function Fn(_0x5aed85){if(!Array['isArray'](_0x5aed85)||_0x5aed85['length']===0x0)throw Q('unitIDs\x20must\x20be\x20a\x20non-empty\x20array');if(_0x5aed85['length']>0x64)throw Q('unitIDs\x20cannot\x20contain\x20more\x20than\x20100\x20values');let _0x1eaea3=[],_0x25d73f=new Set();for(let _0x24df05 of _0x5aed85){if(typeof _0x24df05!='string'||_0x24df05['trim']()['length']===0x0)throw Q('unitIDs\x20cannot\x20contain\x20empty\x20values');_0x25d73f['has'](_0x24df05)||(_0x25d73f['add'](_0x24df05),_0x1eaea3['push'](_0x24df05));}return _0x1eaea3;}function In(_0x7065a9,_0x533f52,_0x533692){let _0x40bf6b=_0x533692?new Set(['hard-deleted','already-hard-deleted']):new Set(['soft-deleted','already-soft-deleted']);Rn(_0x7065a9?.['units'],_0x533f52,_0x40bf6b,'delete');}function Ln(_0x5c8beb,_0x1495a0){let _0x3b1785=new Set(['recovered','already-active']);Rn(_0x5c8beb?.['units'],_0x1495a0,_0x3b1785,'recover');}function Rn(_0x67752c,_0x624e23,_0xfcdf47,_0xa6fba5){if(!Array['isArray'](_0x67752c)||_0x67752c['length']!==_0x624e23['length'])throw Hn('Database\x20returned\x20incomplete\x20'+_0xa6fba5+'\x20Unit\x20results');for(let [_0x1d6d5c,_0x3fb738]of _0x67752c['entries']())if(!_0x3fb738||_0x3fb738['unitID']!==_0x624e23[_0x1d6d5c]||!_0xfcdf47['has'](_0x3fb738['status']))throw Hn('Database\x20returned\x20invalid\x20'+_0xa6fba5+'\x20Unit\x20results');}function zn(_0xab42a0,_0x2657d6){if(!Number['isSafeInteger'](_0x2657d6)||_0x2657d6<0x0)throw Q(_0xab42a0+'\x20must\x20be\x20a\x20non-negative\x20safe\x20integer');}function Bn(_0x3a9c0c,_0x3e86c1){let _0x3cc5e8=_0x3a9c0c===0x0?_0x3e86c1['headRevision']:_0x3a9c0c;if(_0x3cc5e8<0x1||_0x3cc5e8>_0x3e86c1['headRevision'])throw Q('Requested\x20revision\x20is\x20outside\x20the\x20stored\x20unit\x20history');return _0x3cc5e8;}function Vn(_0x59a23a,_0xdcf00,_0x56006a,_0x11fa74,_0x355ce5){let _0x29c4e8=_0x11fa74;for(let _0x1cd5cc of _0x59a23a){if(_0x1cd5cc['unitID']!==_0xdcf00||_0x1cd5cc['type']!==_0x56006a||_0x1cd5cc['baseRev']!==_0x29c4e8-0x1||_0x1cd5cc['revision']!==_0x29c4e8)throw new S('ADAPTER_FAILURE','Database\x20returned\x20a\x20non-contiguous\x20changeset\x20history',{'retryable':!0x0});_0x29c4e8+=0x1;}if(_0x355ce5!==void 0x0&&_0x29c4e8-0x1!==_0x355ce5)throw new S('ADAPTER_FAILURE','Database\x20returned\x20an\x20incomplete\x20changeset\x20history',{'retryable':!0x0});}function Q(_0xb0c12a){return new S('INVALID_REQUEST',_0xb0c12a);}function Hn(_0x2c7d96){return new S('ADAPTER_FAILURE',_0x2c7d96,{'retryable':!0x0});}function Un(_0x58db13){return _0x58db13 instanceof Error?_0x58db13['message']:String(_0x58db13);}var Wn=class{['_reader']=new Gn();['_runtime']=new K({'reader':this['_reader']});['_coordinator']=new kn();['_lifecycle']=new jn('Unit\x20Snapshot\x20Materializer');['materializeSnapshot'](_0x17b222){return this['_lifecycle']['run'](async()=>{Kn(_0x17b222);let {snapshot:_0xdf5362,targetRevision:_0x31e2f1}=_0x17b222;return this['_coordinator']['runExclusive'](_0xdf5362['unitID'],async()=>{this['_runtime']['disposeUnit'](_0xdf5362['unitID']),this['_reader']['bind'](_0x17b222);let _0x2683d5={'userID':'unit-snapshot-materializer','customData':Object['create'](null),'request':Object['create'](null)},_0x569b96;try{_0x569b96=await this['_runtime']['ensureUnit'](_0x2683d5,_0xdf5362['unitID'],_0xdf5362['type']);let _0x9f3f43=await this['_runtime']['createSnapshot'](_0x569b96);if(_0x9f3f43['snapshot']['unitID']!==_0xdf5362['unitID']||_0x9f3f43['snapshot']['type']!==_0xdf5362['type']||_0x9f3f43['snapshot']['rev']!==_0x31e2f1)throw new S('INTERNAL_ERROR','Unit\x20Runtime\x20materialized\x20an\x20unexpected\x20snapshot\x20revision',{'retryable':!0x0});return{'snapshot':_0x9f3f43['snapshot'],'sheetBlocks':[..._0x9f3f43['sheetBlocks']??[]]};}finally{_0x569b96&&this['_runtime']['releaseUnit'](_0x569b96),this['_runtime']['disposeUnit'](_0xdf5362['unitID']),this['_reader']['unbind'](_0xdf5362['unitID']);}});});}['dispose'](){return this['_lifecycle']['dispose'](()=>this['_runtime']['dispose']());}},Gn=class{['_bound']=new Map();['bind'](_0x4795e0){let _0x290930;try{_0x290930={'snapshot':structuredClone(_0x4795e0['snapshot']),'sheetBlocks':structuredClone(_0x4795e0['sheetBlocks']),'changesets':structuredClone(_0x4795e0['changesets']),'targetRevision':_0x4795e0['targetRevision']};}catch(_0x31009c){throw new S('INVALID_REQUEST','Materialization\x20input\x20must\x20be\x20structured-cloneable',{'cause':_0x31009c});}this['_bound']['set'](_0x290930['snapshot']['unitID'],{'input':_0x290930,'blocks':new Map(_0x290930['sheetBlocks']['map'](_0x3ae5ad=>[_0x3ae5ad['id'],_0x3ae5ad]))});}['unbind'](_0xda92f5){this['_bound']['delete'](_0xda92f5);}async['getUnit'](_0x580a1d,_0x2c07b0){let _0x558587=this['_bound']['get'](_0x2c07b0);return _0x558587?{'unitID':_0x2c07b0,'type':_0x558587['input']['snapshot']['type'],'headRevision':_0x558587['input']['targetRevision']}:null;}async['getSnapshot'](_0x5c5835,_0x10d36a,_0x1e7731){let _0x7cec83=this['_bound']['get'](_0x10d36a),_0x2c054c=_0x1e7731?.['revision']??_0x7cec83?.['input']['targetRevision'];return _0x7cec83&&_0x2c054c!==void 0x0&&_0x7cec83['input']['snapshot']['rev']<=_0x2c054c?_0x7cec83['input']['snapshot']:null;}async['getChangesets'](_0x5ba85a,_0x27f415,_0x4fd7d2){let _0x1c4092=this['_bound']['get'](_0x27f415);if(!_0x1c4092)return null;let _0x221513=Math['min'](_0x4fd7d2['to']??_0x1c4092['input']['targetRevision'],_0x1c4092['input']['targetRevision']);return _0x1c4092['input']['changesets']['filter'](_0x52620e=>_0x52620e['revision']>_0x4fd7d2['from']&&_0x52620e['revision']<=_0x221513);}['getSheetBlock'](_0x458239,_0x31c58a,_0x35a382){return Promise['resolve'](this['_require'](_0x31c58a)['blocks']['get'](_0x35a382)??null);}['_require'](_0x37a586){let _0x3e7a8f=this['_bound']['get'](_0x37a586);if(!_0x3e7a8f)throw new S('INTERNAL_ERROR','Materialization\x20data\x20for\x20Unit\x20'+_0x37a586+'\x20is\x20unavailable',{'retryable':!0x0});return _0x3e7a8f;}};function Kn(_0x560d6a){if(!_0x560d6a||typeof _0x560d6a!='object'||!_0x560d6a['snapshot'])throw $('Materialization\x20input\x20requires\x20a\x20snapshot');let {snapshot:_0x56b435,targetRevision:_0x46dfd7,changesets:_0x4613e0,sheetBlocks:_0x32644b}=_0x560d6a;if(typeof _0x56b435['unitID']!='string'||_0x56b435['unitID']['length']===0x0||!Number['isSafeInteger'](_0x56b435['rev'])||_0x56b435['rev']<0x1||!Number['isSafeInteger'](_0x46dfd7)||_0x46dfd7<_0x56b435['rev'])throw $('Materialization\x20revisions\x20are\x20invalid');if(!Array['isArray'](_0x4613e0)||!Array['isArray'](_0x32644b))throw $('Materialization\x20changesets\x20and\x20sheetBlocks\x20must\x20be\x20arrays');let _0x13230f=_0x56b435['rev']+0x1;for(let _0x1b7d70 of _0x4613e0){if(_0x1b7d70['unitID']!==_0x56b435['unitID']||_0x1b7d70['type']!==_0x56b435['type']||_0x1b7d70['baseRev']!==_0x13230f-0x1||_0x1b7d70['revision']!==_0x13230f)throw $('Materialization\x20changesets\x20are\x20not\x20contiguous');_0x13230f+=0x1;}if(_0x13230f-0x1!==_0x46dfd7)throw $('Materialization\x20changesets\x20do\x20not\x20reach\x20targetRevision');let _0xa78b00=new Map();for(let _0xe7ccc3 of _0x32644b){if(!_0xe7ccc3||typeof _0xe7ccc3['id']!='string'||_0xe7ccc3['id']['length']===0x0||_0xa78b00['has'](_0xe7ccc3['id']))throw $('Materialization\x20Sheet\x20blocks\x20are\x20invalid');_0xa78b00['set'](_0xe7ccc3['id'],_0xe7ccc3);}for(let _0x2d4b5f of et(_0x56b435))if(!_0xa78b00['has'](_0x2d4b5f))throw $('Materialization\x20is\x20missing\x20Sheet\x20block\x20'+_0x2d4b5f);}function $(_0x250365){return new S('INVALID_REQUEST',_0x250365);}exports['CollabError']=S,exports['MAX_UNIT_LIFECYCLE_BATCH_SIZE']=Nn,exports['UnitSnapshotMaterializer']=Wn,exports['UniverCollabService']=Pn,exports['UniverUnitRuntime']=K;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x2e08e5=_0x53c3;function _0x67a7(){const _0x1a9a7a=['UnitSnapshotMaterializer','10HpRNGv','2612sHihMC','9301086taKlmj','UniverCollabService','MAX_UNIT_LIFECYCLE_BATCH_SIZE','6272380oRLAcc','1329035OOWBvH','6999324MBWUkl','129OpCbVb','UniverUnitRuntime','4TbIIPX','10149496Gaabxh','874776XNdHUL'];_0x67a7=function(){return _0x1a9a7a;};return _0x67a7();}(function(_0x904f10,_0x9a7ceb){const _0x2849f6=_0x53c3,_0x44962e=_0x904f10();while(!![]){try{const _0xe2a7fa=parseInt(_0x2849f6(0x1e4))/0x1+-parseInt(_0x2849f6(0x1df))/0x2*(parseInt(_0x2849f6(0x1d8))/0x3)+-parseInt(_0x2849f6(0x1da))/0x4*(parseInt(_0x2849f6(0x1e3))/0x5)+parseInt(_0x2849f6(0x1e5))/0x6+-parseInt(_0x2849f6(0x1db))/0x7+parseInt(_0x2849f6(0x1dc))/0x8+-parseInt(_0x2849f6(0x1e0))/0x9*(-parseInt(_0x2849f6(0x1de))/0xa);if(_0xe2a7fa===_0x9a7ceb)break;else _0x44962e['push'](_0x44962e['shift']());}catch(_0x5cf887){_0x44962e['push'](_0x44962e['shift']());}}}(_0x67a7,0xd6504));import _0x1eab91 from'./index.cjs';const facadeExport0=_0x1eab91['CollabError'],facadeExport1=_0x1eab91[_0x2e08e5(0x1e2)],facadeExport2=_0x1eab91[_0x2e08e5(0x1dd)],facadeExport3=_0x1eab91[_0x2e08e5(0x1e1)],facadeExport4=_0x1eab91[_0x2e08e5(0x1d9)];function _0x53c3(_0x4cd6a6,_0x43c143){_0x4cd6a6=_0x4cd6a6-0x1d8;const _0x67a7c2=_0x67a7();let _0x53c388=_0x67a7c2[_0x4cd6a6];return _0x53c388;}export{facadeExport0 as CollabError,facadeExport1 as MAX_UNIT_LIFECYCLE_BATCH_SIZE,facadeExport2 as UnitSnapshotMaterializer,facadeExport3 as UniverCollabService,facadeExport4 as UniverUnitRuntime};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs-pro/collaboration-service",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -16,54 +16,54 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@univerjs-pro/bases": "1.0.
|
|
20
|
-
"@univerjs-pro/bases-dashboard": "1.0.
|
|
21
|
-
"@univerjs-pro/bases-thread-comment": "1.0.
|
|
22
|
-
"@univerjs-pro/boards": "1.0.
|
|
23
|
-
"@univerjs-pro/boards-chart": "1.0.
|
|
24
|
-
"@univerjs-pro/boards-mind": "1.0.
|
|
25
|
-
"@univerjs-pro/boards-table": "1.0.
|
|
26
|
-
"@univerjs-pro/boards-thread-comment": "1.0.
|
|
27
|
-
"@univerjs-pro/collaboration": "1.0.
|
|
28
|
-
"@univerjs-pro/docs-callout": "1.0.
|
|
29
|
-
"@univerjs-pro/docs-chart": "1.0.
|
|
30
|
-
"@univerjs-pro/docs-code": "1.0.
|
|
31
|
-
"@univerjs-pro/docs-latex": "1.0.
|
|
32
|
-
"@univerjs-pro/docs-shape": "1.0.
|
|
33
|
-
"@univerjs-pro/docs-table": "1.0.
|
|
34
|
-
"@univerjs-pro/embed": "1.0.
|
|
35
|
-
"@univerjs-pro/engine-chart": "1.0.
|
|
36
|
-
"@univerjs-pro/engine-formula-rust": "1.0.
|
|
37
|
-
"@univerjs-pro/sheets-chart": "1.0.
|
|
38
|
-
"@univerjs-pro/sheets-outline": "1.0.
|
|
39
|
-
"@univerjs-pro/sheets-pivot": "1.0.
|
|
40
|
-
"@univerjs-pro/sheets-shape": "1.0.
|
|
41
|
-
"@univerjs-pro/sheets-sparkline": "1.0.
|
|
42
|
-
"@univerjs-pro/slides": "1.0.
|
|
43
|
-
"@univerjs-pro/slides-chart": "1.0.
|
|
44
|
-
"@univerjs-pro/slides-table": "1.0.
|
|
45
|
-
"@univerjs-pro/slides-thread-comment": "1.0.
|
|
46
|
-
"@univerjs-pro/thread-comment-resource": "1.0.
|
|
47
|
-
"@univerjs/core": "1.0.
|
|
48
|
-
"@univerjs/data-validation": "1.0.
|
|
49
|
-
"@univerjs/docs": "1.0.
|
|
50
|
-
"@univerjs/docs-drawing": "1.0.
|
|
51
|
-
"@univerjs/docs-hyper-link": "1.0.
|
|
52
|
-
"@univerjs/docs-thread-comment": "1.0.
|
|
53
|
-
"@univerjs/drawing": "1.0.
|
|
54
|
-
"@univerjs/engine-formula": "1.0.
|
|
55
|
-
"@univerjs/protocol": "1.0.
|
|
56
|
-
"@univerjs/sheets": "1.0.
|
|
57
|
-
"@univerjs/sheets-conditional-formatting": "1.0.
|
|
58
|
-
"@univerjs/sheets-drawing": "1.0.
|
|
59
|
-
"@univerjs/sheets-filter": "1.0.
|
|
60
|
-
"@univerjs/sheets-formula": "1.0.
|
|
61
|
-
"@univerjs/sheets-hyper-link": "1.0.
|
|
62
|
-
"@univerjs/sheets-note": "1.0.
|
|
63
|
-
"@univerjs/sheets-sort": "1.0.
|
|
64
|
-
"@univerjs/sheets-table": "1.0.
|
|
65
|
-
"@univerjs/sheets-thread-comment": "1.0.
|
|
66
|
-
"@univerjs/thread-comment": "1.0.
|
|
19
|
+
"@univerjs-pro/bases": "1.0.2",
|
|
20
|
+
"@univerjs-pro/bases-dashboard": "1.0.2",
|
|
21
|
+
"@univerjs-pro/bases-thread-comment": "1.0.2",
|
|
22
|
+
"@univerjs-pro/boards": "1.0.2",
|
|
23
|
+
"@univerjs-pro/boards-chart": "1.0.2",
|
|
24
|
+
"@univerjs-pro/boards-mind": "1.0.2",
|
|
25
|
+
"@univerjs-pro/boards-table": "1.0.2",
|
|
26
|
+
"@univerjs-pro/boards-thread-comment": "1.0.2",
|
|
27
|
+
"@univerjs-pro/collaboration": "1.0.2",
|
|
28
|
+
"@univerjs-pro/docs-callout": "1.0.2",
|
|
29
|
+
"@univerjs-pro/docs-chart": "1.0.2",
|
|
30
|
+
"@univerjs-pro/docs-code": "1.0.2",
|
|
31
|
+
"@univerjs-pro/docs-latex": "1.0.2",
|
|
32
|
+
"@univerjs-pro/docs-shape": "1.0.2",
|
|
33
|
+
"@univerjs-pro/docs-table": "1.0.2",
|
|
34
|
+
"@univerjs-pro/embed": "1.0.2",
|
|
35
|
+
"@univerjs-pro/engine-chart": "1.0.2",
|
|
36
|
+
"@univerjs-pro/engine-formula-rust": "1.0.2",
|
|
37
|
+
"@univerjs-pro/sheets-chart": "1.0.2",
|
|
38
|
+
"@univerjs-pro/sheets-outline": "1.0.2",
|
|
39
|
+
"@univerjs-pro/sheets-pivot": "1.0.2",
|
|
40
|
+
"@univerjs-pro/sheets-shape": "1.0.2",
|
|
41
|
+
"@univerjs-pro/sheets-sparkline": "1.0.2",
|
|
42
|
+
"@univerjs-pro/slides": "1.0.2",
|
|
43
|
+
"@univerjs-pro/slides-chart": "1.0.2",
|
|
44
|
+
"@univerjs-pro/slides-table": "1.0.2",
|
|
45
|
+
"@univerjs-pro/slides-thread-comment": "1.0.2",
|
|
46
|
+
"@univerjs-pro/thread-comment-resource": "1.0.2",
|
|
47
|
+
"@univerjs/core": "1.0.2",
|
|
48
|
+
"@univerjs/data-validation": "1.0.2",
|
|
49
|
+
"@univerjs/docs": "1.0.2",
|
|
50
|
+
"@univerjs/docs-drawing": "1.0.2",
|
|
51
|
+
"@univerjs/docs-hyper-link": "1.0.2",
|
|
52
|
+
"@univerjs/docs-thread-comment": "1.0.2",
|
|
53
|
+
"@univerjs/drawing": "1.0.2",
|
|
54
|
+
"@univerjs/engine-formula": "1.0.2",
|
|
55
|
+
"@univerjs/protocol": "1.0.2",
|
|
56
|
+
"@univerjs/sheets": "1.0.2",
|
|
57
|
+
"@univerjs/sheets-conditional-formatting": "1.0.2",
|
|
58
|
+
"@univerjs/sheets-drawing": "1.0.2",
|
|
59
|
+
"@univerjs/sheets-filter": "1.0.2",
|
|
60
|
+
"@univerjs/sheets-formula": "1.0.2",
|
|
61
|
+
"@univerjs/sheets-hyper-link": "1.0.2",
|
|
62
|
+
"@univerjs/sheets-note": "1.0.2",
|
|
63
|
+
"@univerjs/sheets-sort": "1.0.2",
|
|
64
|
+
"@univerjs/sheets-table": "1.0.2",
|
|
65
|
+
"@univerjs/sheets-thread-comment": "1.0.2",
|
|
66
|
+
"@univerjs/thread-comment": "1.0.2",
|
|
67
67
|
"rxjs": "^7.8.2"
|
|
68
68
|
}
|
|
69
69
|
}
|