@univerjs-pro/collaboration-service 1.0.1 → 1.0.3
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=(_0x3cd82f,_0x83f098,_0x281994,_0x302544)=>{if(_0x83f098&&typeof _0x83f098=='object'||typeof _0x83f098=='function'){for(var _0x5f0b9c=r(_0x83f098),_0x5385d8=0x0,_0x4b3041=_0x5f0b9c['length'],_0x4d55fb;_0x5385d8<_0x4b3041;_0x5385d8++)_0x4d55fb=_0x5f0b9c[_0x5385d8],!a['call'](_0x3cd82f,_0x4d55fb)&&_0x4d55fb!==_0x281994&&t(_0x3cd82f,_0x4d55fb,{'get':(_0x104959=>_0x83f098[_0x104959])['bind'](null,_0x4d55fb),'enumerable':!(_0x302544=n(_0x83f098,_0x4d55fb))||_0x302544['enumerable']});}return _0x3cd82f;},s=(_0x10343d,_0x6ac1f6,_0x2ee23)=>(_0x2ee23=_0x10343d==null?{}:e(i(_0x10343d)),o(_0x6ac1f6||!_0x10343d||!_0x10343d['__esModule']?t(_0x2ee23,'default',{'value':_0x10343d,'enumerable':!0x0}):_0x2ee23,_0x10343d));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'),v=require('@univerjs/sheets-filter'),y=require('@univerjs/thread-comment'),b=require('@univerjs-pro/slides-chart'),x=require('@univerjs-pro/slides'),S=require('@univerjs-pro/slides-table'),te=require('node:async_hooks'),ne=require('@univerjs-pro/bases-dashboard'),re=require('@univerjs-pro/bases-thread-comment'),ie=require('@univerjs-pro/boards-chart'),ae=require('@univerjs-pro/boards-mind'),oe=require('@univerjs-pro/boards-table'),se=require('@univerjs-pro/boards-thread-comment'),ce=require('@univerjs-pro/docs-callout'),le=require('@univerjs-pro/docs-chart'),ue=require('@univerjs-pro/docs-code'),de=require('@univerjs-pro/docs-latex'),fe=require('@univerjs-pro/docs-shape'),pe=require('@univerjs-pro/docs-table'),me=require('@univerjs-pro/embed'),he=require('@univerjs-pro/engine-formula-rust'),ge=require('@univerjs-pro/sheets-chart'),_e=require('@univerjs-pro/sheets-outline'),ve=require('@univerjs-pro/sheets-pivot'),ye=require('@univerjs-pro/sheets-shape'),be=require('@univerjs-pro/sheets-sparkline'),xe=require('@univerjs-pro/slides-thread-comment'),Se=require('@univerjs-pro/thread-comment-resource'),Ce=require('@univerjs/docs-drawing'),we=require('@univerjs/docs-hyper-link'),Te=require('@univerjs/docs-thread-comment'),Ee=require('@univerjs/drawing'),De=require('@univerjs/sheets-drawing'),Oe=require('@univerjs/sheets-formula'),ke=require('@univerjs/sheets-hyper-link'),Ae=require('@univerjs/sheets-note'),je=require('@univerjs/sheets-sort'),Me=require('@univerjs/sheets-table'),Ne=require('@univerjs/sheets-thread-comment');var C=class extends Error{['code'];['retryable'];['details'];constructor(_0x11b8c2,_0x326bda,_0x6d9754={}){super(_0x326bda,{'cause':_0x6d9754['cause']}),this['name']='CollabError',this['code']=_0x11b8c2,this['retryable']=_0x6d9754['retryable']??!0x1,_0x6d9754['details']!==void 0x0&&(this['details']=_0x6d9754['details']);}},Pe=0x32,Fe=0x5*0x400*0x400,Ie={'shouldCreate'(_0x15666f){return _0x15666f['revisionsSinceLastSnapshot']>=Pe||_0x15666f['changesetBytes']>=Fe;}};function w(_0x221308){return Re(_0x221308),{'userID':_0x221308['userID'],'customData':_0x221308['customData']??Object['create'](null)};}function Le(_0x3eeb5f){if(Re(_0x3eeb5f),typeof _0x3eeb5f['memberID']!='string'||_0x3eeb5f['memberID']['length']===0x0)throw T('memberID\x20must\x20be\x20a\x20non-empty\x20string');return{'userID':_0x3eeb5f['userID'],'memberID':_0x3eeb5f['memberID'],'customData':_0x3eeb5f['customData']??Object['create'](null)};}function Re(_0x50f2fd){if(!_0x50f2fd||typeof _0x50f2fd!='object')throw T('context\x20must\x20be\x20an\x20object');if(typeof _0x50f2fd['userID']!='string'||_0x50f2fd['userID']['length']===0x0)throw T('userID\x20must\x20be\x20a\x20non-empty\x20string');if(_0x50f2fd['customData']!==void 0x0&&(_0x50f2fd['customData']===null||typeof _0x50f2fd['customData']!='object'||Array['isArray'](_0x50f2fd['customData'])))throw T('customData\x20must\x20be\x20an\x20object');}function T(_0x54dc56){return new C('INVALID_REQUEST',_0x54dc56);}var ze=class{['_middlewares']=new Map();['use'](_0x39ea71,_0x50282b){let _0x2e0ff1=this['_middlewares']['get'](_0x39ea71)??[],_0x2015b5=_0x50282b;_0x2e0ff1['push'](_0x2015b5),this['_middlewares']['set'](_0x39ea71,_0x2e0ff1);let _0x2bbc0e=!0x1;return{'dispose':()=>{if(_0x2bbc0e)return;_0x2bbc0e=!0x0;let _0x35cdcf=_0x2e0ff1['indexOf'](_0x2015b5);_0x35cdcf>=0x0&&_0x2e0ff1['splice'](_0x35cdcf,0x1);}};}async['run'](_0x15f1bc,_0x554a58,_0x1e13b8){let _0x3193ea=[...this['_middlewares']['get'](_0x15f1bc)??[]],_0x6d34eb=async _0x1957ac=>{let _0x1ef560=_0x3193ea[_0x1957ac];if(!_0x1ef560){await _0x1e13b8();return;}let _0x135c71=!0x1,_0x4d9e89,_0x30c628=()=>{if(_0x135c71)throw Error('Middleware\x20for\x20action\x20'+String(_0x15f1bc)+'\x20called\x20next()\x20more\x20than\x20once');return _0x135c71=!0x0,_0x4d9e89=_0x6d34eb(_0x1957ac+0x1),_0x4d9e89;};try{await _0x1ef560(_0x554a58,_0x30c628);}catch(_0x3eced2){if(_0x4d9e89)try{await _0x4d9e89;}catch{}throw _0x3eced2;}if(!_0x135c71)throw Error('Middleware\x20for\x20action\x20'+String(_0x15f1bc)+'\x20completed\x20without\x20calling\x20next()');await _0x4d9e89;};await _0x6d34eb(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(_0x127509){return _0x127509?{'debug':(..._0x5de189)=>E(()=>_0x127509['debug'](..._0x5de189)),'info':(..._0x1d0060)=>E(()=>_0x127509['info'](..._0x1d0060)),'warn':(..._0x5d76f2)=>E(()=>_0x127509['warn'](..._0x5d76f2)),'error':(..._0x5aa587)=>E(()=>_0x127509['error'](..._0x5aa587))}:Be;}function Ue(_0x46cd1c){return _0x46cd1c?{'increment':(..._0x3b2465)=>E(()=>_0x46cd1c['increment'](..._0x3b2465)),'observe':(..._0x57abc9)=>E(()=>_0x46cd1c['observe'](..._0x57abc9))}:Ve;}function E(_0x3fca1a){try{_0x3fca1a();}catch{}}function We(_0x53ef41){return{..._0x53ef41};}function Ge(_0x392f6c){return{..._0x392f6c};}function Ke(_0x322cbe){return{..._0x322cbe};}function qe(_0x105b12){return{..._0x105b12};}function Je(_0x21e1e8){return{'unitIDs':_0x21e1e8['unitIDs'],'hardDelete':_0x21e1e8['hardDelete']??!0x1};}function Ye(_0x14a797){return{'unitIDs':_0x14a797['unitIDs']};}function Xe(_0x4fe2d9,_0x2d27e){return{'changeset':{..._0x4fe2d9['changeset'],'userID':_0x2d27e['userID'],'memberID':_0x2d27e['memberID']}};}async function Ze(_0x323d30){let _0x5c5433=$e(),_0x1fbfc4=(await Qe(_0x323d30,_0x5c5433['service']))['snapshot']??_0x5c5433['snapshot'];if(!_0x1fbfc4||_0x1fbfc4['unitID']!==_0x323d30['data']['id']||_0x1fbfc4['type']!==_0x323d30['type']||_0x1fbfc4['rev']!==0x1)throw Error('SDK\x20Unit\x20data\x20transform\x20returned\x20an\x20invalid\x20snapshot');return{'snapshot':_0x1fbfc4,..._0x5c5433['sheetBlocks']['length']>0x0?{'sheetBlocks':_0x5c5433['sheetBlocks']}:{}};}function Qe(_0x1fc936,_0x500c8d){switch(_0x1fc936['type']){case c['UniverType']['UNIVER_SHEET']:{let _0x4b3d28=structuredClone(_0x1fc936['data']);return(0x0,l['transformWorkbookDataToSnapshot'])({},_0x4b3d28,_0x4b3d28['id'],0x1,_0x500c8d);}case c['UniverType']['UNIVER_DOC']:{let _0x26286a=structuredClone(_0x1fc936['data']);return(0x0,l['transformDocumentDataToSnapshot'])({},_0x26286a,_0x26286a['id'],0x1,_0x500c8d);}case c['UniverType']['UNIVER_SLIDE']:{let _0x1fa7bb=structuredClone(_0x1fc936['data']);return(0x0,l['transformSlideDataToSnapshot'])(_0x1fa7bb['resources'],_0x1fa7bb,_0x1fa7bb['id'],0x1,_0x500c8d);}case c['UniverType']['UNIVER_BOARD']:{let _0x43dd5d=structuredClone(_0x1fc936['data']);return(0x0,l['transformBoardDataToSnapshot'])(_0x43dd5d['resources'],_0x43dd5d,_0x43dd5d['id'],0x1,_0x500c8d);}case c['UniverType']['UNIVER_BASE']:{let _0x5187d1=structuredClone(_0x1fc936['data']);return(0x0,l['transformBaseDataToSnapshot'])({},_0x5187d1,_0x5187d1['id'],0x1,_0x500c8d);}}}function $e(){let _0x5c5a85={},_0x2948e1=[],_0x33fe17={'code':c['ErrorCode']['OK'],'message':''},_0x171cfc=async(_0x20b016,_0x3cc6d5)=>{if(!_0x3cc6d5['snapshot'])throw Error('SDK\x20transform\x20attempted\x20to\x20save\x20an\x20empty\x20snapshot');return _0x5c5a85['snapshot']=_0x3cc6d5['snapshot'],{'error':_0x33fe17};};return{'service':{'saveSnapshot':_0x171cfc,'updateSnapshot':_0x171cfc,'saveSheetBlock':async(_0x660435,_0x5c2cb9)=>{if(!_0x5c2cb9['block'])throw Error('SDK\x20transform\x20attempted\x20to\x20save\x20an\x20empty\x20block');return _0x2948e1['push'](_0x5c2cb9['block']),{'error':_0x33fe17,'blockID':_0x5c2cb9['block']['id']};}},'sheetBlocks':_0x2948e1,get 'snapshot'(){return _0x5c5a85['snapshot'];}};}function et(_0x3311ae){if(_0x3311ae['type']!==c['UniverType']['UNIVER_SHEET']&&_0x3311ae['type']!==c['UniverType']['UNIVER_BASE'])return[];let _0x186e70=[],_0x304898=new Set();for(let _0x5b9284 of Object['values'](_0x3311ae['workbook']?.['blockMeta']??{}))for(let _0x44c6a5 of _0x5b9284['blocks'])_0x304898['has'](_0x44c6a5)||(_0x304898['add'](_0x44c6a5),_0x186e70['push'](_0x44c6a5));return _0x186e70;}function D(_0x193e65,_0x54089f,_0x16afd3){let _0x47c2e8=new Map(_0x16afd3['map'](_0x271b64=>[_0x271b64['objectId'],_0x271b64])),_0x501c6e=[];for(let _0x57381a of _0x54089f){let _0x382802=_0x47c2e8['get'](_0x57381a);_0x382802&&_0x501c6e['push']({'unitID':_0x193e65,'objectID':_0x382802['permissionId'],'objectType':_0x382802['objectType'],'action':c['UnitAction']['Edit']});}return _0x501c6e;}function tt(_0x37b941,_0x3b8a93,_0x9d677a){if(_0x9d677a==='base.mutation.apply-base-json1'&&st(_0x3b8a93['op']))return nt(_0x37b941,_0x3b8a93['op']);let _0x422c4a=new Set(),_0x30a5d4=O(_0x3b8a93,'table'),_0x57ce1b=typeof _0x3b8a93['tableId']=='string'?_0x3b8a93['tableId']:_0x30a5d4[0x0];if(_0x30a5d4['forEach'](_0x32833f=>_0x422c4a['add']((0x0,p['getBaseTablePermissionObjectId'])(_0x32833f))),!_0x57ce1b)return[..._0x422c4a];let _0x2c12b6=_0x37b941['getSnapshot']()['tables'][_0x57ce1b],_0x47aafb=new Set(O(_0x3b8a93,'field')),_0x17b1e8=new Set(O(_0x3b8a93,'record')),_0x3343fd=new Set(O(_0x3b8a93,'view'));return ot(_0x2c12b6,_0x3b8a93['patches'],_0x17b1e8,_0x47aafb),k(_0x3b8a93,_0x47aafb),_0x47aafb['forEach'](_0x236092=>_0x422c4a['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x57ce1b,_0x236092))),_0x17b1e8['forEach'](_0x3f74ca=>_0x422c4a['add']((0x0,p['getBaseRecordPermissionObjectId'])(_0x57ce1b,_0x3f74ca))),_0x3343fd['forEach'](_0x155536=>_0x422c4a['add']((0x0,p['getBaseViewPermissionObjectId'])(_0x57ce1b,_0x155536))),[..._0x422c4a];}function nt(_0x3631f6,_0x1fd2bb){let _0x515dd5=_0x3631f6['getSnapshot'](),_0x27836a=new p['BaseJson1OpApplier']()['getAffectedRanges'](_0x1fd2bb),_0x281c27=rt(_0x1fd2bb),_0x237a65=new Set();return _0x27836a['forEach'](_0x1bedf4=>{let {tableId:_0x4f77dc}=_0x1bedf4;if(!_0x4f77dc)return;_0x237a65['add']((0x0,p['getBaseTablePermissionObjectId'])(_0x4f77dc));let _0x202074=_0x515dd5['tables'][_0x4f77dc],_0x353aa3=_0x1bedf4['recordId']??(_0x1bedf4['row']==null?void 0x0:_0x202074?.['rowId']?.[_0x1bedf4['row']]),_0x118820=_0x1bedf4['fieldId']??(_0x1bedf4['column']==null?void 0x0:_0x202074?.['colId']?.[_0x1bedf4['column']]);_0x353aa3&&_0x237a65['add']((0x0,p['getBaseRecordPermissionObjectId'])(_0x4f77dc,_0x353aa3)),_0x118820&&_0x237a65['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x4f77dc,_0x118820)),_0x1bedf4['viewId']&&_0x237a65['add']((0x0,p['getBaseViewPermissionObjectId'])(_0x4f77dc,_0x1bedf4['viewId'])),(_0x1bedf4['reason']==='table'||_0x281c27['has'](_0x4f77dc))&&_0x202074&&(Object['keys'](_0x202074['fields'])['forEach'](_0x509f52=>_0x237a65['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x4f77dc,_0x509f52))),Object['keys'](_0x202074['records'])['forEach'](_0x2415ce=>_0x237a65['add']((0x0,p['getBaseRecordPermissionObjectId'])(_0x4f77dc,_0x2415ce))),Object['keys'](_0x202074['views'])['forEach'](_0x51919e=>_0x237a65['add']((0x0,p['getBaseViewPermissionObjectId'])(_0x4f77dc,_0x51919e)))),_0x1bedf4['reason']==='record'&&_0x202074&&Object['keys'](_0x202074['fields'])['forEach'](_0xd1ccbb=>_0x237a65['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x4f77dc,_0xd1ccbb)));}),_0x27836a['length']===0x0&&at(_0x1fd2bb,'tableOrder')&&Object['keys'](_0x515dd5['tables'])['forEach'](_0x467316=>_0x237a65['add']((0x0,p['getBaseTablePermissionObjectId'])(_0x467316))),[..._0x237a65];}function rt(_0x39c358){let _0x1c6d6d=new Set(),_0x2f0a87=_0x3b5981=>{Array['isArray'](_0x3b5981)&&_0x3b5981['forEach']((_0x4cee80,_0x44ee2b)=>{_0x4cee80==='tables'&&typeof _0x3b5981[_0x44ee2b+0x1]=='string'&&it(_0x3b5981[_0x44ee2b+0x2])&&_0x1c6d6d['add'](_0x3b5981[_0x44ee2b+0x1]),_0x2f0a87(_0x4cee80);});};return _0x2f0a87(_0x39c358),_0x1c6d6d;}function it(_0x5bfa56){return!!_0x5bfa56&&typeof _0x5bfa56=='object'&&!Array['isArray'](_0x5bfa56)&&('i'in _0x5bfa56||'r'in _0x5bfa56||'p'in _0x5bfa56||'d'in _0x5bfa56||'es'in _0x5bfa56||'ena'in _0x5bfa56||'et'in _0x5bfa56);}function at(_0x3ead77,_0x14a134){return Array['isArray'](_0x3ead77)&&_0x3ead77['some'](_0x298d80=>_0x298d80===_0x14a134||at(_0x298d80,_0x14a134));}function O(_0x3aad49,_0x4586ed){let _0x351967=new Set(),_0x497d95=_0x4586ed+'Id',_0x158ac9=_0x4586ed+'Ids',_0x2a6d47=(_0x4c9d26,_0x15e618='')=>{if(typeof _0x4c9d26=='string'){_0x15e618===_0x497d95&&_0x351967['add'](_0x4c9d26);return;}if(Array['isArray'](_0x4c9d26)){_0x15e618===_0x158ac9?_0x4c9d26['forEach'](_0x2336a2=>{typeof _0x2336a2=='string'&&_0x351967['add'](_0x2336a2);}):_0x4c9d26['forEach'](_0x57d60f=>_0x2a6d47(_0x57d60f,_0x15e618));return;}A(_0x4c9d26)&&Object['entries'](_0x4c9d26)['forEach'](([_0x1cd3d6,_0x428514])=>{_0x1cd3d6==='id'&&_0x15e618===_0x4586ed&&typeof _0x428514=='string'?_0x351967['add'](_0x428514):_0x2a6d47(_0x428514,_0x1cd3d6);});};return _0x2a6d47(_0x3aad49),[..._0x351967];}function ot(_0x981ab1,_0xa937d2,_0x21f709,_0x113d4f){!_0x981ab1||!Array['isArray'](_0xa937d2)||_0xa937d2['forEach'](_0x4ce56e=>{if(!A(_0x4ce56e))return;let _0x585fe1=_0x4ce56e;if(typeof _0x585fe1['row']=='number'){let _0x5cf1b1=_0x981ab1['rowId']?.[_0x585fe1['row']];_0x5cf1b1&&_0x21f709['add'](_0x5cf1b1);}if(typeof _0x585fe1['col']=='number'){let _0x50e0d8=_0x981ab1['colId']?.[_0x585fe1['col']];_0x50e0d8&&_0x113d4f['add'](_0x50e0d8);}});}function k(_0x272fac,_0x1baac2,_0x26ba62=''){if(!(!_0x272fac||typeof _0x272fac!='object')){if(Array['isArray'](_0x272fac)){_0x272fac['forEach'](_0x5cca0f=>k(_0x5cca0f,_0x1baac2,_0x26ba62));return;}A(_0x272fac)&&Object['entries'](_0x272fac)['forEach'](([_0x11fa94,_0x29794e])=>{_0x26ba62==='values'&&_0x1baac2['add'](_0x11fa94),k(_0x29794e,_0x1baac2,_0x11fa94);});}}function st(_0x30846b){return Array['isArray'](_0x30846b);}function A(_0x5db092){return typeof _0x5db092=='object'&&!!_0x5db092&&!Array['isArray'](_0x5db092);}function j(_0x4bf078,_0x1894e7,_0x22631e){let _0x34b495=_0x4bf078['get'](u['IResourceManagerService'])['getAllResourceHooks']()['find'](_0x4b1c98=>_0x4b1c98['pluginName']===_0x22631e['name']&&_0x4b1c98['businesses']['includes'](_0x22631e['business']));if(!_0x34b495)throw new C('INTERNAL_ERROR',_0x22631e['label']+'\x20permission\x20resource\x20is\x20not\x20registered');try{let _0x3a78fb=JSON['parse'](_0x34b495['toJson'](_0x1894e7));if(!Array['isArray'](_0x3a78fb)||!_0x3a78fb['every'](_0x1de7bf=>ct(_0x1de7bf,_0x22631e['objectTypes'])))throw Error('Invalid\x20'+_0x22631e['label']+'\x20permission\x20bindings');let _0x118ac4=new Set();for(let _0x2f2f6a of _0x3a78fb){let _0x1b879c=_0x2f2f6a['objectType']+'/'+_0x2f2f6a['objectId'];if(_0x118ac4['has'](_0x1b879c))throw Error('Duplicate\x20'+_0x22631e['label']+'\x20permission\x20binding');_0x118ac4['add'](_0x1b879c);}return _0x3a78fb;}catch(_0x56ed2b){throw new C('INTERNAL_ERROR','Failed\x20to\x20read\x20'+_0x22631e['label']+'\x20permission\x20bindings',{'cause':_0x56ed2b});}}function ct(_0x2deea3,_0x3fa1ad){if(!_0x2deea3||typeof _0x2deea3!='object')return!0x1;let _0x32fa45=_0x2deea3;return typeof _0x32fa45['objectId']=='string'&&_0x32fa45['objectId']['length']>0x0&&typeof _0x32fa45['permissionId']=='string'&&_0x32fa45['permissionId']['length']>0x0&&_0x32fa45['objectType']!==void 0x0&&_0x3fa1ad['has'](_0x32fa45['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(_0x2128c2,_0x2069c8){return j(_0x2128c2,_0x2069c8,lt);}var dt=new Set(['base-dashboard.mutation.patch-dashboard','base-dashboard.mutation.remove-dashboard','base-dashboard.mutation.set-dashboard']);function ft(_0x592c5a,_0x4ce419,_0x1136e4){if(_0x1136e4['id']['startsWith']('thread-comment.mutation.'))return[{'unitID':_0x4ce419,'objectID':_0x4ce419,'objectType':c['UnitObject']['Base'],'action':c['UnitAction']['Comment']}];let _0x339cfb=_0x1136e4['params'],_0x50e974;if(dt['has'](_0x1136e4['id'])){let _0x29f9e1=_0x339cfb['dashboard'],_0x97c694=typeof _0x339cfb['dashboardId']=='string'?_0x339cfb['dashboardId']:_0x29f9e1?.['id'];_0x50e974=new Set(typeof _0x97c694=='string'?[(0x0,p['getBaseDashboardPermissionObjectId'])(_0x97c694)]:[]);}else{if(_0x1136e4['id']['startsWith']('base.mutation.')){let _0x4ff870=_0x592c5a['get'](u['IUniverInstanceService'])['getUnit'](_0x4ce419,u['UniverInstanceType']['UNIVER_BASE']);_0x50e974=new Set(tt(_0x4ff870,_0x339cfb,_0x1136e4['id']));}else return[];}return _0x50e974['size']===0x0?[]:D(_0x4ce419,_0x50e974,ut(_0x592c5a,_0x4ce419));}function pt(_0x107c15,_0x4e33e4){let _0x2e1d1b=typeof _0x4e33e4?.['subUnitId']=='string'?_0x4e33e4['subUnitId']:_0x107c15['getActivePageId'](),_0x186dfe=_0x107c15['getSnapshot']()['pages'][_0x2e1d1b]?.['elements']??{},_0x427b89=new Set(mt(_0x4e33e4)),_0x5cc9ab=M(_0x4e33e4);return _0x5cc9ab['size']&&Object['values'](_0x186dfe)['forEach'](_0x400aeb=>{if(!F(_0x400aeb)||typeof _0x400aeb['id']!='string')return;let _0x442fd2=_0x400aeb;(_0x5cc9ab['has'](String(_0x442fd2['chartId']??''))||_0x5cc9ab['has'](String(_0x442fd2['tableId']??'')))&&_0x427b89['add'](_0x442fd2['id']);}),[...ht(_0x186dfe,_0x427b89)]['map'](_0x3110fa=>(0x0,ee['getBoardElementPermissionObjectId'])(_0x2e1d1b,_0x3110fa));}function mt(_0x44436f,_0x12cabe=''){let _0x453aba=new Set();return P(_0x44436f,_0x12cabe,_0x453aba),[..._0x453aba];}function M(_0x29859f,_0x3df479='',_0x40dddb=new Set()){return F(_0x29859f)?Array['isArray'](_0x29859f)?(_0x29859f['forEach'](_0x4b54c6=>M(_0x4b54c6,_0x3df479,_0x40dddb)),_0x40dddb):(Object['entries'](_0x29859f)['forEach'](([_0x27d3b6,_0x3878cd])=>{(_0x27d3b6==='chartId'||_0x27d3b6==='tableId')&&typeof _0x3878cd=='string'&&_0x40dddb['add'](_0x3878cd),_0x27d3b6==='id'&&(_0x3df479==='chart'||_0x3df479==='table')&&typeof _0x3878cd=='string'&&_0x40dddb['add'](_0x3878cd),M(_0x3878cd,_0x27d3b6,_0x40dddb);}),_0x40dddb):_0x40dddb;}function ht(_0x5dbb2e,_0x3d1073){let _0x5d14f4=new Set(_0x3d1073),_0x219350=Object['values'](_0x5dbb2e)['filter'](F)['filter'](_0x175646=>typeof _0x175646['id']=='string'),_0x5b23da=_0x546125=>{let _0x59b2e7=_0x5dbb2e[_0x546125];!_0x59b2e7||typeof _0x59b2e7!='object'||N(_0x59b2e7,/^(parentId|groupId|parentNodeId|structureScopeId)$/i)['forEach'](_0x502119=>{_0x5d14f4['has'](_0x502119)||!_0x5dbb2e[_0x502119]||(_0x5d14f4['add'](_0x502119),_0x5b23da(_0x502119));});};_0x3d1073['forEach'](_0x5b23da);let _0xa09b3d=new Set(_0x3d1073),_0x3de26d=!0x0;for(;_0x3de26d;)_0x3de26d=!0x1,_0x219350['forEach'](_0x2b884e=>{_0xa09b3d['has'](_0x2b884e['id'])||N(_0x2b884e,/(?:parent|group|child|owner|root|start|end|from|to|bound|structureScope).*(?:Id|Ids)$/i)['some'](_0x3359f0=>_0xa09b3d['has'](_0x3359f0))&&(_0xa09b3d['add'](_0x2b884e['id']),_0x5d14f4['add'](_0x2b884e['id']),_0x3de26d=!0x0);});return _0x5d14f4;}function N(_0xbfbecf,_0x5a34e4,_0x3fa4b0='',_0x4e7e26=new Set()){return typeof _0xbfbecf=='string'?(_0x5a34e4['test'](_0x3fa4b0)&&_0x4e7e26['add'](_0xbfbecf),[..._0x4e7e26]):Array['isArray'](_0xbfbecf)?(_0x5a34e4['test'](_0x3fa4b0)?_0xbfbecf['forEach'](_0x322d92=>{typeof _0x322d92=='string'&&_0x4e7e26['add'](_0x322d92);}):_0xbfbecf['forEach'](_0x576eac=>N(_0x576eac,_0x5a34e4,_0x3fa4b0,_0x4e7e26)),[..._0x4e7e26]):(F(_0xbfbecf)&&Object['entries'](_0xbfbecf)['forEach'](([_0x3eaa03,_0x1428d5])=>N(_0x1428d5,_0x5a34e4,_0x3eaa03,_0x4e7e26)),[..._0x4e7e26]);}function P(_0x1170fd,_0x343025,_0x4758e1){if(typeof _0x1170fd=='string'){/^(elementId|drawingId|connectorId|containerId|swimlaneId|[a-z]*nodeId)$/i['test'](_0x343025)&&_0x4758e1['add'](_0x1170fd);return;}if(Array['isArray'](_0x1170fd)){/^(element|drawing|connector|container|swimlane|[a-z]*node)Ids$/i['test'](_0x343025)?_0x1170fd['forEach'](_0x350cab=>{typeof _0x350cab=='string'&&_0x4758e1['add'](_0x350cab);}):_0x1170fd['forEach'](_0x4aecdb=>P(_0x4aecdb,_0x343025,_0x4758e1));return;}F(_0x1170fd)&&Object['entries'](_0x1170fd)['forEach'](([_0x4dd95a,_0x1f717d])=>{_0x4dd95a==='id'&&(_0x343025==='element'||_0x343025==='elements')?typeof _0x1f717d=='string'&&_0x4758e1['add'](_0x1f717d):P(_0x1f717d,_0x4dd95a,_0x4758e1);});}function F(_0x92e8cd){return typeof _0x92e8cd=='object'&&!!_0x92e8cd&&!Array['isArray'](_0x92e8cd);}var gt={'name':'BOARD_OBJECT_PERMISSION_PLUGIN','business':u['UniverInstanceType']['UNIVER_BOARD'],'objectTypes':new Set([c['UnitObject']['BoardElement']]),'label':'Board'};function _t(_0x42e7c9,_0x3221a5){return j(_0x42e7c9,_0x3221a5,gt);}function vt(_0x5d9771,_0x2c098e,_0x190932){if(_0x190932['id']['startsWith']('thread-comment.mutation.'))return[{'unitID':_0x2c098e,'objectID':_0x2c098e,'objectType':c['UnitObject']['Board'],'action':c['UnitAction']['Comment']}];if(!_0x190932['id']['startsWith']('board.mutation.'))return[];let _0x9625ea=_0x190932['params'];if(_0x190932['id']==='board.mutation.update-element'&&_0x9625ea['formulaLastValueGuard'])return[];let _0x231323=_0x5d9771['get'](u['IUniverInstanceService'])['getUnit'](_0x2c098e,u['UniverInstanceType']['UNIVER_BOARD']),_0x12eacd=new Set(pt(_0x231323,_0x9625ea));return _0x12eacd['size']===0x0?[]:D(_0x2c098e,_0x12eacd,_t(_0x5d9771,_0x2c098e));}var yt=['defaultHeaderId','defaultFooterId','firstPageHeaderId','firstPageFooterId','evenPageHeaderId','evenPageFooterId'],bt=new WeakMap();function I(_0x4be478){let _0x1ea473=_0x4be478['getMutationRevision']?.()??NaN,_0x6f049f=bt['get'](_0x4be478);if(_0x6f049f?.['mutationRevision']===_0x1ea473)return _0x6f049f;let _0x581a85=_0x4be478['getSnapshot'](),_0x49e145=_0x581a85['body']?(0x0,m['getTopLevelSectionBreaks'])(_0x581a85['body']):[],_0x19fdf6=new Map(),_0x57d240=(_0x5c1f89,_0x13c837)=>{for(let _0xc87a11 of _0x5c1f89?.['customBlocks']??[])_0x19fdf6['has'](_0xc87a11['blockId'])||_0x19fdf6['set'](_0xc87a11['blockId'],_0x13c837);};_0x57d240(_0x581a85['body'],''),Object['entries'](_0x581a85['headers']??{})['forEach'](([_0xa01b40,_0x591c82])=>_0x57d240(_0x591c82['body'],_0xa01b40)),Object['entries'](_0x581a85['footers']??{})['forEach'](([_0x384685,_0xa74450])=>_0x57d240(_0xa74450['body'],_0x384685)),Object['entries'](_0x581a85['notes']??{})['forEach'](([_0x1eb07a,_0x3a6fdf])=>_0x57d240(_0x3a6fdf['body'],_0x1eb07a));let _0x573fde=new Map();for(let _0x23bb97 of _0x581a85['body']?.['customRanges']??[])(_0x23bb97['rangeType']===u['CustomRangeType']['FOOTNOTE']||_0x23bb97['rangeType']===u['CustomRangeType']['ENDNOTE'])&&typeof _0x23bb97['properties']?.['noteId']=='string'&&_0x573fde['set'](_0x23bb97['properties']['noteId'],{'startOffset':_0x23bb97['startIndex'],'endOffset':_0x23bb97['endIndex']+0x1});let _0x5346c7={'drawingSegmentIds':_0x19fdf6,'footnoteReferenceRanges':_0x573fde,'mutationRevision':_0x1ea473,'segments':new Map(),'topLevelSections':_0x49e145};return bt['set'](_0x4be478,_0x5346c7),_0x5346c7;}function xt(_0x1248b3,_0x460188,_0x28ab0f=I(_0x1248b3)){let _0x27c92b=_0x28ab0f['segments']['get'](_0x460188);if(_0x27c92b)return _0x27c92b;let _0x5c8964=_0x1248b3['getSelfOrHeaderFooterModel'](_0x460188)?.['getBody']()??null,_0x1a03ae=_0x1248b3['getSnapshot'](),_0x38c8e4=_0x1a03ae['notes']?.[_0x460188],_0x441c54=(_0x38c8e4?_0x38c8e4['drawings']:_0x1a03ae['drawings'])??{},_0x2f2fd8=_0x5c8964==null?[]:[...(_0x5c8964['tables']??[])['map'](_0x16ebf1=>({'type':'table','id':_0x16ebf1['tableId'],'startOffset':_0x16ebf1['startIndex'],'endOffset':_0x16ebf1['endIndex']})),...(_0x5c8964['customBlocks']??[])['map'](_0x2439df=>({'type':_0x441c54[_0x2439df['blockId']]?'drawing':'custom-block','id':_0x2439df['blockId'],'startOffset':_0x2439df['startIndex'],'endOffset':_0x2439df['startIndex']+0x1})),...(_0x5c8964['blockRanges']??[])['map'](_0xb3cb2=>({'type':'block-range','id':_0xb3cb2['blockId'],'startOffset':_0xb3cb2['startIndex'],'endOffset':_0xb3cb2['endIndex']+0x1})),...(_0x5c8964['customRanges']??[])['map'](_0x2164ad=>({'type':'custom-range','id':_0x2164ad['rangeId'],'startOffset':_0x2164ad['startIndex'],'endOffset':_0x2164ad['endIndex']+0x1})),...(_0x5c8964['columnGroups']??[])['map'](_0x161467=>({'type':'column-group','id':_0x161467['columnGroupId'],'startOffset':_0x161467['startIndex'],'endOffset':_0x161467['endIndex']+0x1}))],_0x2185db=new Map(_0x2f2fd8['map'](_0x112ce1=>[_0x112ce1['type']+':'+_0x112ce1['id'],{'startOffset':_0x112ce1['startOffset'],'endOffset':_0x112ce1['endOffset']}]));for(let _0x5c2dd1 of _0x5c8964?.['customBlocks']??[]){let _0x45b8d7={'startOffset':_0x5c2dd1['startIndex'],'endOffset':_0x5c2dd1['startIndex']+0x1};_0x2185db['set']('custom-block:'+_0x5c2dd1['blockId'],_0x45b8d7),_0x2185db['set']('drawing:'+_0x5c2dd1['blockId'],_0x45b8d7);}let _0x532007={'body':_0x5c8964,'entities':_0x2f2fd8,'entityRanges':_0x2185db,'paragraphContentStartOffsets':_0x5c8964==null?new Map():(0x0,u['getParagraphContentStartOffsets'])(_0x5c8964),'paragraphsById':new Map((_0x5c8964?.['paragraphs']??[])['filter'](_0x1a5255=>_0x1a5255['paragraphId']!=null)['map'](_0x2c37f2=>[_0x2c37f2['paragraphId'],_0x2c37f2]))};return _0x28ab0f['segments']['set'](_0x460188,_0x532007),_0x532007;}function St(_0x36f2f5,_0x5dc8be){return I(_0x36f2f5)['drawingSegmentIds']['get'](_0x5dc8be)??'';}function Ct(_0x27caf0,_0x42c7d8,_0x55a6ee){let _0x2ec8ee=I(_0x27caf0),_0x239db6=xt(_0x27caf0,_0x42c7d8,_0x2ec8ee),{body:_0xb44974}=_0x239db6;return _0xb44974?[...L(_0x27caf0,_0x42c7d8,_0x55a6ee,_0x2ec8ee),...kt(_0xb44974,_0x42c7d8,_0x55a6ee,_0x239db6),...At(_0x42c7d8,_0x55a6ee,_0x239db6)]:[];}function wt(_0x1b6c4c,_0x399097,_0x33fed8){let _0x30921f=new Set();if(_0x33fed8==null)return[];let _0x289e3d=u['JSON1']['type']['readCursor'](_0x33fed8);return _0x289e3d['traverse'](null,()=>{let _0x10aa85=_0x289e3d['getPath'](),_0x5a14a4=_0x289e3d['getComponent'](),_0x4d0f92=['headers','footers','notes']['includes'](String(_0x10aa85[0x0]))&&typeof _0x10aa85[0x1]=='string'?_0x10aa85[0x1]:_0x399097;if(_0x10aa85[0x0]==='notes'&&typeof _0x10aa85[0x1]=='string'&&L(_0x1b6c4c,_0x10aa85[0x1],{'startOffset':0x0,'endOffset':0x0})['forEach'](_0x2c0356=>_0x30921f['add'](_0x2c0356)),_0x10aa85[0x0]==='noteSettings'&&I(_0x1b6c4c)['topLevelSections']['forEach'](_0x323c80=>{_0x30921f['add']((0x0,m['getDocumentSectionPermissionObjectId'])('',_0x323c80['sectionId']));}),_0x10aa85[0x0]==='body'&&_0x10aa85[0x1]==='sectionBreaks'&&typeof _0x10aa85[0x2]=='number'&&(_0x10aa85[0x3]==='noteProperties'||_0x10aa85[0x3]==='suppressEndnotes')){let _0x46025a=_0x1b6c4c['getBody']()?.['sectionBreaks']?.[_0x10aa85[0x2]]?.['sectionId'];_0x46025a&&_0x30921f['add']((0x0,m['getDocumentSectionPermissionObjectId'])('',_0x46025a));}if(_0x10aa85[_0x10aa85['length']-0x1]!=='body'||_0x5a14a4?.['et']!==u['TextX']['id']||!Array['isArray'](_0x5a14a4['e'])||!_0x5a14a4['e']['every'](Et))return;let _0x21cb92=_0x5a14a4['e'],_0x55fe47=0x0,_0x345359=(_0x5f5a14,_0x4d3268)=>{Ct(_0x1b6c4c,_0x4d0f92,{'startOffset':_0x5f5a14,'endOffset':_0x4d3268})['forEach'](_0x563853=>_0x30921f['add'](_0x563853));};_0x21cb92['forEach'](_0x86f236=>{if(_0x86f236['t']===u['TextXActionType']['INSERT']){_0x345359(_0x55fe47,_0x55fe47);return;}if(_0x86f236['t']===u['TextXActionType']['DELETE']){_0x345359(_0x55fe47,_0x55fe47+_0x86f236['len']),_0x55fe47+=_0x86f236['len'];return;}(_0x86f236['body']!==void 0x0||_0x86f236['oldBody']!==void 0x0||_0x86f236['coverType']!==void 0x0)&&_0x345359(_0x55fe47,_0x55fe47+_0x86f236['len']),_0x55fe47+=_0x86f236['len'];});}),Tt(_0x33fed8)['forEach'](_0xad9640=>{_0x30921f['add']((0x0,m['getDocumentEntityPermissionObjectId'])(_0x399097,'drawing',_0xad9640));let _0x23a82=(_0x1b6c4c['getSelfOrHeaderFooterModel'](_0x399097)?.['getBody']())?.['customBlocks']?.['find'](_0xaa2c4=>_0xaa2c4['blockId']===_0xad9640);_0x23a82&&L(_0x1b6c4c,_0x399097,{'startOffset':_0x23a82['startIndex'],'endOffset':_0x23a82['startIndex']+0x1})['forEach'](_0x1b935e=>_0x30921f['add'](_0x1b935e));}),[..._0x30921f];}function Tt(_0xd71dd4){let _0x37d9dd=new Set(),_0x51b486=_0x5ad6d4=>{if(Array['isArray'](_0x5ad6d4)){_0x5ad6d4['forEach']((_0x167bb1,_0x49bf2e)=>{_0x167bb1==='drawings'&&typeof _0x5ad6d4[_0x49bf2e+0x1]=='string'&&_0x37d9dd['add'](_0x5ad6d4[_0x49bf2e+0x1]),_0x51b486(_0x167bb1);});return;}Dt(_0x5ad6d4)&&Object['values'](_0x5ad6d4)['forEach'](_0x51b486);};return _0x51b486(_0xd71dd4),[..._0x37d9dd];}function Et(_0x59c656){return!Dt(_0x59c656)||typeof _0x59c656['len']!='number'?!0x1:_0x59c656['t']===u['TextXActionType']['INSERT']?Dt(_0x59c656['body']):_0x59c656['t']===u['TextXActionType']['RETAIN']||_0x59c656['t']===u['TextXActionType']['DELETE'];}function Dt(_0x1ee8c2){return typeof _0x1ee8c2=='object'&&!!_0x1ee8c2&&!Array['isArray'](_0x1ee8c2);}function Ot(_0x4cad8f,_0x359434,_0x2fc8e2,_0xe0ec33){let _0x55bce8=I(_0x4cad8f),_0x1a77fe=xt(_0x4cad8f,_0x359434,_0x55bce8)['entityRanges']['get'](_0x2fc8e2+':'+_0xe0ec33)??null;return _0x1a77fe?L(_0x4cad8f,_0x359434,_0x1a77fe,_0x55bce8):[];}function L(_0x591d38,_0x350c20,_0x400c9f,_0x2c046f=I(_0x591d38)){if(_0x350c20){let _0x1c7eab=_0x2c046f['footnoteReferenceRanges']['get'](_0x350c20);return _0x1c7eab?Ct(_0x591d38,'',_0x1c7eab):Mt(_0x591d38,_0x350c20,_0x2c046f['topLevelSections'])['map'](_0x171d72=>(0x0,m['getDocumentSectionPermissionObjectId'])('',_0x171d72));}return jt(_0x2c046f['topLevelSections'],_0x400c9f)['map'](_0x58720f=>(0x0,m['getDocumentSectionPermissionObjectId'])('',_0x58720f['sectionId']));}function kt(_0x4da5c8,_0x39b7de,_0x12cfe7,_0x188dc9){let _0x4c267b=Math['min'](_0x12cfe7['startOffset'],_0x12cfe7['endOffset']),_0x225da7=Math['max'](_0x12cfe7['startOffset'],_0x12cfe7['endOffset']);return(_0x4da5c8['paragraphs']??[])['filter'](_0x5d85f7=>R(_0x188dc9['paragraphContentStartOffsets']['get'](_0x5d85f7['startIndex'])??(0x0,u['getParagraphContentStartOffset'])(_0x4da5c8,_0x5d85f7),_0x5d85f7['startIndex']+0x1,_0x4c267b,_0x225da7))['flatMap'](_0x2b0fc8=>_0x2b0fc8['paragraphId']?[(0x0,m['getDocumentParagraphPermissionObjectId'])(_0x39b7de,_0x2b0fc8['paragraphId'])]:[]);}function At(_0x3508ea,_0x64e088,_0x2dda09){let _0x10a001=Math['min'](_0x64e088['startOffset'],_0x64e088['endOffset']),_0x156584=Math['max'](_0x64e088['startOffset'],_0x64e088['endOffset']);return _0x2dda09['entities']['filter'](_0x4dfd8a=>R(_0x4dfd8a['startOffset'],_0x4dfd8a['endOffset'],_0x10a001,_0x156584))['map'](_0x109593=>(0x0,m['getDocumentEntityPermissionObjectId'])(_0x3508ea,_0x109593['type'],_0x109593['id']));}function jt(_0x51c2a1,_0x207e85){let _0x1e06a2=Math['min'](_0x207e85['startOffset'],_0x207e85['endOffset']),_0xcd296=Math['max'](_0x207e85['startOffset'],_0x207e85['endOffset']);return _0x51c2a1['filter']((_0x4c143f,_0x4002d6)=>R(_0x4002d6===0x0?0x0:_0x51c2a1[_0x4002d6-0x1]['startIndex']+0x1,_0x4c143f['startIndex']+0x1,_0x1e06a2,_0xcd296));}function R(_0x591414,_0x1e127f,_0x467f8c,_0x205f5d){return _0x467f8c===_0x205f5d?_0x467f8c>=_0x591414&&_0x467f8c<_0x1e127f:_0x467f8c<_0x1e127f&&_0x205f5d>_0x591414;}function Mt(_0x34727d,_0x4256d1,_0x531e31=I(_0x34727d)['topLevelSections']){let _0x279495=_0x34727d['getSnapshot'](),_0x320535=new Set();return _0x531e31['forEach']((_0x5276aa,_0x3120e6)=>{yt['some'](_0xcd8a97=>(0x0,u['resolveSectionHeaderFooterReference'])(_0x279495['documentStyle'],_0x531e31,_0x3120e6,_0xcd8a97)['segmentId']===_0x4256d1)&&_0x320535['add'](_0x5276aa['sectionId']);}),[..._0x320535];}function Nt(_0x266444,_0xd256ed){let _0x34ef19=z(_0xd256ed['params'])?_0xd256ed['params']:void 0x0;if(_0xd256ed['id']===m['RichTextEditingMutation']['id']){let _0x21561a=_0xd256ed['params'];return wt(_0x266444,_0x21561a['segmentId']??'',_0x21561a['actions']);}return _0xd256ed['id']==='doc.mutation.rename-doc'||_0xd256ed['id']==='docs-formula.mutation.set-last-values'||_0xd256ed['id']==='doc.mutation.update-shape-data'&&_0x34ef19?.['formulaLastValueGuard']?[]:Pt(_0x266444,_0xd256ed);}function Pt(_0x5e97c,_0x5528d2){let _0x27ae4a=_0x5528d2['params'];if(!z(_0x27ae4a))return[];let _0x581687=new Set(),_0x467722=(_0x5c59e2,_0x5eae8b,_0x27b28a)=>{_0x581687['add']((0x0,m['getDocumentEntityPermissionObjectId'])(_0x5c59e2,_0x5eae8b,_0x27b28a)),Ot(_0x5e97c,_0x5c59e2,_0x5eae8b,_0x27b28a)['forEach'](_0x3a0ab1=>_0x581687['add'](_0x3a0ab1));};return Ft(_0x27ae4a)['forEach'](({entityType:_0xe240be,entityId:_0x898025})=>{let _0x35e3a1=_0x27ae4a['segmentId'],_0x4a8047=typeof _0x35e3a1=='string'?_0x35e3a1:_0xe240be==='drawing'||_0xe240be==='custom-block'?St(_0x5e97c,_0x898025):'';_0x467722(_0x4a8047,_0xe240be,_0x898025);}),[..._0x581687];}function Ft(_0x58e08b){let _0x46855d=new Map(),_0x291514={'blockId':['custom-block'],'drawingId':['drawing'],'shapeId':['drawing','custom-block'],'tableId':['table'],'rangeId':['custom-range'],'columnGroupId':['column-group']},_0x43170c=(_0x25a931,_0x2161f1='')=>{if(typeof _0x25a931=='string'){_0x291514[_0x2161f1]?.['forEach'](_0x5b1539=>{_0x46855d['set'](_0x5b1539+'\x1f'+_0x25a931,{'entityType':_0x5b1539,'entityId':_0x25a931});});return;}if(Array['isArray'](_0x25a931)){let _0x58bcc2=_0x2161f1['endsWith']('Ids')?_0x2161f1['slice'](0x0,-0x3)+'Id':_0x2161f1;_0x25a931['forEach'](_0xc06477=>_0x43170c(_0xc06477,_0x58bcc2));return;}z(_0x25a931)&&Object['entries'](_0x25a931)['forEach'](([_0x50a0fd,_0xf112f9])=>_0x43170c(_0xf112f9,_0x50a0fd));};return _0x43170c(_0x58e08b),[..._0x46855d['values']()];}function z(_0x151721){return typeof _0x151721=='object'&&!!_0x151721&&!Array['isArray'](_0x151721);}var It={'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 Lt(_0x230d3a,_0x456b0e){return j(_0x230d3a,_0x456b0e,It);}function Rt(_0x268d15,_0x19a315,_0x122735){if(_0x122735['id']['startsWith']('thread-comment.mutation.'))return[{'unitID':_0x19a315,'objectID':_0x19a315,'objectType':c['UnitObject']['Document'],'action':c['UnitAction']['Comment']}];let _0x69db8=_0x268d15['get'](u['IUniverInstanceService'])['getUnit'](_0x19a315,u['UniverInstanceType']['UNIVER_DOC']),_0x2671bc=new Set(Nt(_0x69db8,_0x122735));return _0x2671bc['size']===0x0?[]:D(_0x19a315,_0x2671bc,Lt(_0x268d15,_0x19a315));}function zt(_0x2d15fd){let {startRow:_0x2d5e28,startColumn:_0x1d9303,endRow:_0x26ad9f,endColumn:_0x3cbe1f,rangeType:_0x741c0b}=_0x2d15fd;return(Number['isNaN'](_0x2d5e28)||[u['RANGE_TYPE']['ALL'],u['RANGE_TYPE']['COLUMN']]['includes'](_0x741c0b))&&(_0x2d15fd['startRow']=0x0),(Number['isNaN'](_0x26ad9f)||[u['RANGE_TYPE']['ALL'],u['RANGE_TYPE']['COLUMN']]['includes'](_0x741c0b))&&(_0x2d15fd['endRow']=u['MAX_ROW_COUNT']-0x1),(Number['isNaN'](_0x1d9303)||[u['RANGE_TYPE']['ALL'],u['RANGE_TYPE']['ROW']]['includes'](_0x741c0b))&&(_0x2d15fd['startColumn']=0x0),(Number['isNaN'](_0x3cbe1f)||[u['RANGE_TYPE']['ALL'],u['RANGE_TYPE']['ROW']]['includes'](_0x741c0b))&&(_0x2d15fd['endColumn']=u['MAX_COLUMN_COUNT']-0x1),_0x2d15fd;}function Bt(_0xfccbc6,_0x50d28d){return[new h['WorkbookEditablePermission'](_0xfccbc6),new h['WorksheetEditPermission'](_0xfccbc6,_0x50d28d)];}function B(_0x244870,_0x3a5cda){return _0x244870['get'](u['IUniverInstanceService'])['getUnitType'](_0x3a5cda)===u['UniverInstanceType']['UNIVER_SHEET'];}function V(_0x19588d,_0x30faa1,_0x2ea8e4,_0x21f5af,_0x1f7df3){let _0x4d486a=[];_0x1f7df3['workbookTypes']?.['forEach'](_0x998f68=>{_0x4d486a['push'](new _0x998f68(_0x30faa1));}),_0x1f7df3['worksheetTypes']?.['forEach'](_0x4f1740=>{_0x4d486a['push'](new _0x4f1740(_0x30faa1,_0x2ea8e4));});let _0x33e66f=_0x21f5af['map'](_0xbe4448=>zt({..._0xbe4448})),_0x2fa99a=_0x19588d['get'](h['RangeProtectionRuleModel'])['getSubunitRuleList'](_0x30faa1,_0x2ea8e4)['filter'](_0x4de34d=>_0x4de34d['ranges']['some'](_0x165b57=>_0x33e66f['some'](_0x44a6cb=>u['Rectangle']['intersects'](_0x165b57,_0x44a6cb))));return _0x1f7df3['rangeTypes']?.['forEach'](_0x17c3f9=>{_0x2fa99a['forEach'](_0x277ff0=>{_0x4d486a['push'](new _0x17c3f9(_0x30faa1,_0x2ea8e4,_0x277ff0['permissionId']));});}),_0x4d486a;}function H(_0x3e38a0,_0x2ef013){return _0x2ef013['map'](_0x4127bf=>new _0x4127bf(_0x3e38a0));}var Vt=[{'id':g['AddConditionalRuleMutation']['id'],'handle'(_0x3cb7ae,_0x649c8e){let {params:_0x257780}=_0x649c8e;return V(_0x3cb7ae,_0x257780['unitId'],_0x257780['subUnitId'],_0x257780['rule']['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':_['AddDataValidationMutation']['id'],'handle'(_0x16cbea,_0x2cae54){let {unitId:_0x583925,subUnitId:_0x311c8c}=_0x2cae54['params'];if(!B(_0x16cbea,_0x583925))return[];let _0x39ed98=[];return Array['isArray'](_0x2cae54['params']['rule'])?_0x2cae54['params']['rule']['forEach'](_0x1422a0=>{_0x39ed98['push'](..._0x1422a0['ranges']);}):_0x39ed98['push'](..._0x2cae54['params']['rule']['ranges']),V(_0x16cbea,_0x583925,_0x311c8c,_0x39ed98,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['AddRangeProtectionMutation']['id'],'handle'(_0x17ee3f,_0x2d73e3){let {params:_0x4786e4}=_0x2d73e3,{unitId:_0x5c90db}=_0x4786e4;return[new h['WorkbookCreateProtectPermission'](_0x5c90db)];}},{'id':h['AddWorksheetMergeMutation']['id'],'handle'(_0x424c77,_0x3fad97){let {params:_0x22ce98}=_0x3fad97;return V(_0x424c77,_0x22ce98['unitId'],_0x22ce98['subUnitId'],_0x22ce98['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission'],h['WorksheetSetCellValuePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':g['DeleteConditionalRuleMutation']['id'],'handle'(_0x26b941,_0x232e3f){let {params:_0x88ca3f}=_0x232e3f,_0x27b1dd=_0x26b941['get'](g['ConditionalFormattingRuleModel'])['getRule'](_0x88ca3f['unitId'],_0x88ca3f['subUnitId'],_0x88ca3f['cfId']);return _0x27b1dd?V(_0x26b941,_0x88ca3f['unitId'],_0x88ca3f['subUnitId'],_0x27b1dd['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]}):[];}},{'id':h['DeleteRangeProtectionMutation']['id'],'handle'(_0x3aed35,_0x3ee9f3){let {params:_0x2e225a}=_0x3ee9f3,{unitId:_0x396a8e,subUnitId:_0xc25dcb,ruleIds:_0x1e7bef}=_0x2e225a,_0x3f2f0e=_0x3aed35['get'](h['RangeProtectionRuleModel']),_0x3b3db2=[];for(let _0x24cbd6 of _0x1e7bef){let _0xd9dd6=_0x3f2f0e['getRule'](_0x396a8e,_0xc25dcb,_0x24cbd6);if(!_0xd9dd6)return!0x1;_0x3b3db2['push'](new h['RangeProtectionPermissionDeleteProtectionPoint'](_0x396a8e,_0xc25dcb,_0xd9dd6['permissionId']));}return _0x3b3db2;}},{'id':h['DeleteWorksheetProtectionMutation']['id'],'handle'(_0x4e3fe7,_0x1ca9fa){let {params:_0x4ff850}=_0x1ca9fa,{unitId:_0x362118,subUnitId:_0x346410}=_0x4ff850;return[new h['WorksheetDeleteProtectionPermission'](_0x362118,_0x346410)];}},{'id':h['ToggleGridlinesMutation']['id'],'handle'(_0x172c4b,_0x3e09c6){let {params:_0x18716f}=_0x3e09c6;return[new h['WorkbookEditablePermission'](_0x18716f['unitId']),new h['WorksheetEditPermission'](_0x18716f['unitId'],_0x18716f['subUnitId'])];}},{'id':h['InsertColMutation']['id'],'handle'(_0x5010fc,_0xe450c3){let {params:_0x742d18}=_0xe450c3,_0x200fc2={..._0x742d18['range']};return _0x200fc2['rangeType']=u['RANGE_TYPE']['COLUMN'],V(_0x5010fc,_0x742d18['unitId'],_0x742d18['subUnitId'],[_0x200fc2],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetInsertColumnPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['InsertRowMutation']['id'],'handle'(_0x3d8302,_0x1ea6cb){let {params:_0x5c1ef9}=_0x1ea6cb,_0xd488e8={..._0x5c1ef9['range']};return _0xd488e8['rangeType']=u['RANGE_TYPE']['ROW'],V(_0x3d8302,_0x5c1ef9['unitId'],_0x5c1ef9['subUnitId'],[_0xd488e8],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetInsertRowPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['InsertSheetMutation']['id'],'handle'(_0xb6135b,_0x1aa9b1){let {params:_0x37db0b}=_0x1aa9b1;return H(_0x37db0b['unitId'],[h['WorkbookCreateSheetPermission']]);}},{'id':h['MoveColsMutation']['id'],'handle'(_0x5b6e7e,_0x448ef0){let {params:_0x49217a}=_0x448ef0,_0x311493={..._0x49217a['sourceRange']};_0x311493['rangeType']=u['RANGE_TYPE']['COLUMN'];let _0x3fb699={..._0x49217a['targetRange']};return _0x3fb699['rangeType']=u['RANGE_TYPE']['COLUMN'],V(_0x5b6e7e,_0x49217a['unitId'],_0x49217a['subUnitId'],[_0x311493,_0x3fb699],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':g['MoveConditionalRuleMutation']['id'],'handle'(_0x5f5002,_0xabbb48){let {params:_0x51ea92}=_0xabbb48;return Bt(_0x51ea92['unitId'],_0x51ea92['subUnitId']);}},{'id':h['MoveRangeMutation']['id'],'handle'(_0x5606db,_0x2f2111){let {params:_0x1a3169}=_0x2f2111,_0x27a756=new u['ObjectMatrix'](_0x1a3169['from']['value'])['getDataRange'](),_0x2b55ce=new u['ObjectMatrix'](_0x1a3169['to']['value'])['getDataRange']();return V(_0x5606db,_0x1a3169['unitId'],_0x1a3169['from']['subUnitId'],[_0x27a756,_0x2b55ce],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['MoveRowsMutation']['id'],'handle'(_0x4c4c1e,_0x8bd0e6){let {params:_0x27eae0}=_0x8bd0e6,_0x39cad1={..._0x27eae0['sourceRange']};_0x39cad1['rangeType']=u['RANGE_TYPE']['ROW'];let _0x4d1a40={..._0x27eae0['targetRange']};return _0x4d1a40['rangeType']=u['RANGE_TYPE']['ROW'],V(_0x4c4c1e,_0x27eae0['unitId'],_0x27eae0['subUnitId'],[_0x39cad1,_0x4d1a40],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveColMutation']['id'],'handle'(_0x2ca6e7,_0x1fed41){let {params:_0x1796b1}=_0x1fed41,_0x331e69={..._0x1796b1['range']};return _0x331e69['rangeType']=u['RANGE_TYPE']['COLUMN'],V(_0x2ca6e7,_0x1796b1['unitId'],_0x1796b1['subUnitId'],[_0x331e69],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetDeleteColumnPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':_['RemoveDataValidationMutation']['id'],'handle'(_0x43bd76,_0x5ed0f1){let {unitId:_0x240467,subUnitId:_0x95359c,ruleId:_0x4732a8}=_0x5ed0f1['params'];if(!B(_0x43bd76,_0x240467))return[];let _0x4fbb17=_0x43bd76['get'](_['DataValidationModel']),_0x4121ed=(Array['isArray'](_0x4732a8)?_0x4732a8:[_0x4732a8])['map'](_0x3a2c0b=>_0x4fbb17['getRuleById'](_0x240467,_0x95359c,_0x3a2c0b)),_0x5d285a=[];return _0x4121ed['forEach'](_0xf34b4e=>{_0xf34b4e?.['ranges']&&_0x5d285a['push'](..._0xf34b4e['ranges']);}),V(_0x43bd76,_0x240467,_0x95359c,_0x5d285a,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveNumfmtMutation']['id'],'handle'(_0x4591b0,_0xb45d17){let {params:_0x44f75f}=_0xb45d17,{ranges:_0x47b180}=_0x44f75f;return V(_0x4591b0,_0x44f75f['unitId'],_0x44f75f['subUnitId'],_0x47b180,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveRowMutation']['id'],'handle'(_0x278abd,_0x20605c){let {params:_0x152d3c}=_0x20605c,_0x1ccf02={..._0x152d3c['range']};return _0x1ccf02['rangeType']=u['RANGE_TYPE']['ROW'],V(_0x278abd,_0x152d3c['unitId'],_0x152d3c['subUnitId'],[_0x1ccf02],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetDeleteRowPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveSheetMutation']['id'],'handle'(_0x33c212,_0x283c9c){let {params:_0x5414e2}=_0x283c9c;return H(_0x5414e2['unitId'],[h['WorkbookDeleteSheetPermission']]);}},{'id':v['RemoveSheetsFilterMutation']['id'],'handle'(_0x4c344e,_0xd1ef12){let {params:_0x216c6d}=_0xd1ef12;return V(_0x4c344e,_0x216c6d['unitId'],_0x216c6d['subUnitId'],[],{'worksheetTypes':[h['WorksheetViewPermission']],'rangeTypes':[h['RangeProtectionPermissionViewPoint']]});}},{'id':h['RemoveWorksheetMergeMutation']['id'],'handle'(_0x5f1222,_0x17e034){let {params:_0x5ea80d}=_0x17e034;return V(_0x5f1222,_0x5ea80d['unitId'],_0x5ea80d['subUnitId'],_0x5ea80d['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission'],h['WorksheetSetCellValuePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['ReorderRangeMutation']['id'],'handle'(_0x56568b,_0x115267){let {params:_0xc3c855}=_0x115267,{range:_0x39f266}=_0xc3c855;return V(_0x56568b,_0xc3c855['unitId'],_0xc3c855['subUnitId'],[_0x39f266],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetSortPermission'],h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['SetWorksheetColWidthMutation']['id'],'handle'(_0x45eb93,_0x3b735a){let {params:_0x41b99e}=_0x3b735a,_0x3f892b=[..._0x41b99e['ranges']]['map'](_0xd512e=>{let _0x470486={..._0xd512e};return _0x470486['rangeType']=u['RANGE_TYPE']['COLUMN'],_0x470486;});return V(_0x45eb93,_0x41b99e['unitId'],_0x41b99e['subUnitId'],_0x3f892b,{'worksheetTypes':[h['WorksheetSetColumnStylePermission']]});}},{'id':g['SetConditionalRuleMutation']['id'],'handle'(_0xe4a7a3,_0x5a3131){let {params:_0x479050}=_0x5a3131,_0x3b01b7=_0xe4a7a3['get'](g['ConditionalFormattingRuleModel'])['getRule'](_0x479050['unitId'],_0x479050['subUnitId'],_0x479050['cfId']||_0x479050['rule']['cfId']);return[..._0x3b01b7?V(_0xe4a7a3,_0x479050['unitId'],_0x479050['subUnitId'],_0x3b01b7['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]}):[],...V(_0xe4a7a3,_0x479050['unitId'],_0x479050['subUnitId'],_0x479050['rule']['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]})];}},{'id':h['SetNumfmtMutation']['id'],'handle'(_0x2525d0,_0x1faa5c){let {params:_0x525fd0}=_0x1faa5c,{values:_0x33e280}=_0x525fd0,_0x4877cd=[];return Object['keys'](_0x33e280)['forEach'](_0x4acfbe=>{let _0x62473f=_0x33e280[_0x4acfbe];_0x4877cd['push'](..._0x62473f['ranges']);}),V(_0x2525d0,_0x525fd0['unitId'],_0x525fd0['subUnitId'],_0x4877cd,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['SetRangeProtectionMutation']['id'],'handle'(_0xb8df29,_0x2e526d){let {params:_0x4b4608}=_0x2e526d,{unitId:_0x407020,subUnitId:_0x29bad9,ruleId:_0x9a2ad6}=_0x4b4608,_0x2f4096=_0xb8df29['get'](h['RangeProtectionRuleModel'])['getRule'](_0x407020,_0x29bad9,_0x9a2ad6);return _0x2f4096?[new h['RangeProtectionPermissionManageCollaPoint'](_0x407020,_0x29bad9,_0x2f4096['permissionId'])]:[];}},{'id':h['SetRangeValuesMutation']['id'],'handle'(_0x34bd0d,_0x932bf1){let {params:_0x500e31}=_0x932bf1,_0x42ba0e=new u['ObjectMatrix'](_0x500e31['cellValue']),_0x49b4f1=[new h['WorkbookEditablePermission'](_0x500e31['unitId']),new h['WorksheetEditPermission'](_0x500e31['unitId'],_0x500e31['subUnitId'])],_0x8af920=_0x34bd0d['get'](h['RangeProtectionRuleModel'])['getSubunitRuleList'](_0x500e31['unitId'],_0x500e31['subUnitId']);return _0x42ba0e['forValue']((_0x519148,_0x52f96c)=>{_0x8af920['filter'](_0x1a4924=>_0x1a4924['ranges']['some'](_0x39f357=>_0x519148>=_0x39f357['startRow']&&_0x519148<=_0x39f357['endRow']&&_0x52f96c>=_0x39f357['startColumn']&&_0x52f96c<=_0x39f357['endColumn']))['forEach'](_0xbd4287=>{_0x49b4f1['push'](new h['RangeProtectionPermissionEditPoint'](_0x500e31['unitId'],_0x500e31['subUnitId'],_0xbd4287['permissionId']));});}),_0x49b4f1;}},{'id':h['SetWorksheetRowAutoHeightMutation']['id'],'handle'(_0x4c5374,_0x226088){let {params:_0x540464}=_0x226088,_0x1477c2=_0x540464['rowsAutoHeightInfo']['map'](_0x3e0674=>{let _0x2c3820={'startColumn':0x0,'endColumn':0x0,'startRow':_0x3e0674['row'],'endRow':_0x3e0674['row']};return _0x2c3820['rangeType']=u['RANGE_TYPE']['ROW'],_0x2c3820;});return V(_0x4c5374,_0x540464['unitId'],_0x540464['subUnitId'],_0x1477c2,{'worksheetTypes':[h['WorksheetSetRowStylePermission']]});}},{'id':h['SetWorksheetRowHeightMutation']['id'],'handle'(_0x45a0a4,_0xfe7be5){let {params:_0x44ba3c}=_0xfe7be5,_0x1b2204=[..._0x44ba3c['ranges']]['map'](_0x94c83f=>{let _0x50e3e1={..._0x94c83f};return _0x50e3e1['rangeType']=u['RANGE_TYPE']['ROW'],_0x50e3e1;});return V(_0x45a0a4,_0x44ba3c['unitId'],_0x44ba3c['subUnitId'],_0x1b2204,{'worksheetTypes':[h['WorksheetSetRowStylePermission']]});}},{'id':h['SetWorksheetHideMutation']['id'],'handle'(_0x35c65c,_0x2b8d8a){let {params:_0x2bb018}=_0x2b8d8a;return H(_0x2bb018['unitId'],[h['WorkbookHideSheetPermission']]);}},{'id':h['SetWorksheetNameMutation']['id'],'handle'(_0x1b5337,_0xaeb374){let {params:_0x2fca3c}=_0xaeb374;return H(_0x2fca3c['unitId'],[h['WorkbookRenameSheetPermission']]);}},{'id':h['SetWorksheetOrderMutation']['id'],'handle'(_0x437a93,_0x4fb68c){let {params:_0xe647af}=_0x4fb68c;return H(_0xe647af['unitId'],[h['WorkbookMoveSheetPermission']]);}},{'id':v['SetSheetsFilterRangeMutation']['id'],'handle'(_0x4d81c5,_0x3e365d){let {params:_0x598311}=_0x3e365d;return V(_0x4d81c5,_0x598311['unitId'],_0x598311['subUnitId'],[_0x598311['range']],{'worksheetTypes':[h['WorksheetViewPermission']],'rangeTypes':[h['RangeProtectionPermissionViewPoint']]});}},{'id':h['SetWorksheetProtectionMutation']['id'],'handle'(_0x4c8b79,_0x413048){let {params:_0xdf19e}=_0x413048,{unitId:_0x213c65,subUnitId:_0x2ec18e}=_0xdf19e;return[new h['WorksheetManageCollaboratorPermission'](_0x213c65,_0x2ec18e)];}},{'id':_['UpdateDataValidationMutation']['id'],'handle'(_0xfab76d,_0x1795e5){let {unitId:_0x12c999,subUnitId:_0x3c2e1c,ruleId:_0xeb67a6,payload:_0x93281f}=_0x1795e5['params'];if(!B(_0xfab76d,_0x12c999))return[];let _0x3736aa=_0xfab76d['get'](_['DataValidationModel']),_0x3d58ea=(Array['isArray'](_0xeb67a6)?_0xeb67a6:[_0xeb67a6])['map'](_0x21c958=>_0x3736aa['getRuleById'](_0x12c999,_0x3c2e1c,_0x21c958)),_0x2770e1=[];return _0x3d58ea['forEach'](_0x12db7c=>{_0x12db7c?.['ranges']&&_0x2770e1['push'](..._0x12db7c['ranges']);}),_0x93281f['type']===_['UpdateRuleType']['RANGE']&&_0x2770e1['push'](..._0x93281f['payload']),V(_0xfab76d,_0x12c999,_0x3c2e1c,_0x2770e1,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}}];function Ht(_0x39d243,_0x2df333,_0x18faf9){let _0x1538ab=_0x18faf9;if(_0x1538ab['unitId']!==_0x2df333)throw U('Permission\x20point\x20identifies\x20another\x20Unit');switch(_0x1538ab['type']){case c['UnitObject']['Workbook']:return{'objectID':_0x2df333,'objectType':_0x1538ab['type'],'action':_0x1538ab['subType']};case c['UnitObject']['Worksheet']:return Ut(_0x39d243,_0x2df333,_0x1538ab);case c['UnitObject']['SelectRange']:if(!_0x1538ab['permissionId'])throw U('Range\x20permission\x20point\x20has\x20no\x20object\x20ID');return{'objectID':_0x1538ab['permissionId'],'objectType':_0x1538ab['type'],'action':_0x1538ab['subType']};default:throw U('Unsupported\x20Sheet\x20permission\x20point\x20type');}}function Ut(_0xf1539d,_0x580cd8,_0x37399c){if(!_0x37399c['subUnitId'])throw U('Worksheet\x20permission\x20point\x20has\x20no\x20subUnit\x20ID');let _0x14716b;if(h['baseProtectionActions']['includes'](_0x37399c['subType'])?_0x14716b=_0xf1539d['get'](h['WorksheetProtectionRuleModel'])['getRule'](_0x580cd8,_0x37399c['subUnitId'])?.['permissionId']:h['defaultWorksheetPermissionPoint']['includes'](_0x37399c['subType'])&&(_0x14716b=_0xf1539d['get'](h['WorksheetProtectionPointModel'])['getRule'](_0x580cd8,_0x37399c['subUnitId'])?.['permissionId']),_0x14716b)return{'objectID':_0x14716b,'objectType':c['UnitObject']['Worksheet'],'action':_0x37399c['subType']};}function U(_0x124383){return new C('INVALID_REQUEST',_0x124383);}var Wt=new Map(Vt['map'](_0x2168a4=>[_0x2168a4['id'],_0x2168a4]));function Gt(_0x434d52,_0x40bb5f,_0x3aa3e0){let _0x2762ed=Wt['get'](_0x3aa3e0['id']);if(!_0x2762ed)return[];let _0x74c670=_0x2762ed['handle'](_0x434d52,_0x3aa3e0);if(_0x74c670===!0x1)throw new C('INVALID_REQUEST','Mutation\x20permission\x20analysis\x20failed\x20for\x20'+_0x3aa3e0['id']);let _0x31b042=[];for(let _0x4d5c24 of _0x74c670){let _0x4d1455=Ht(_0x434d52,_0x40bb5f,_0x4d5c24);_0x4d1455&&_0x31b042['push']({'unitID':_0x40bb5f,..._0x4d1455});}return _0x31b042;}var Kt={'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 qt(_0x324ab6,_0x28bb5b){return j(_0x324ab6,_0x28bb5b,Kt);}var Jt=class{['model'];['resourceService'];['targets']=new Set();constructor(_0x7801b3,_0x580fe1){this['model']=_0x7801b3,this['resourceService']=_0x580fe1;}['collect'](_0x3d0a6f){return this['_checkChartMutation'](_0x3d0a6f),this['targets'];}['add'](_0x2832b7){for(let _0x20292f of _0x2832b7)this['targets']['add'](_0x20292f);}['_checkChartMutation'](_0x5c26de){switch(_0x5c26de['id']){case b['RemoveSlideChartDataSourceMutation']['id']:{let _0x5570e5=_0x5c26de['params'];return _0x5570e5&&this['_assertDataSource'](_0x5570e5['unitId'],_0x5570e5['dataSourceId']),!0x0;}case b['RemoveSlideChartSnapshotMutation']['id']:{let _0x2d659d=_0x5c26de['params'];return _0x2d659d&&this['_assertChart'](_0x2d659d['unitId'],_0x2d659d['chartId']),!0x0;}case b['SetSlideChartDataSourceMutation']['id']:{let _0x5197d5=_0x5c26de['params'];return _0x5197d5&&this['_assertDataSource'](_0x5197d5['unitId'],_0x5197d5['dataSource']['id']),!0x0;}case b['SetSlideChartSnapshotMutation']['id']:{let _0x13b64f=_0x5c26de['params'];return _0x13b64f&&this['_assertChart'](_0x13b64f['unitId'],_0x13b64f['chart']['id']),!0x0;}default:return!0x1;}}['_getSlideModel'](_0x5e6837){return _0x5e6837===this['model']['getUnitId']()?this['model']:void 0x0;}['_assertDataSource'](_0x562ad9,_0x40b639){let _0x58cd65=this['resourceService']['getChartIdsByDataSource'](_0x562ad9,_0x40b639);this['_assertCharts'](_0x562ad9,_0x58cd65);}['_assertChart'](_0x1e9d07,_0x4383d2){this['_assertCharts'](_0x1e9d07,[_0x4383d2]);}['_assertCharts'](_0x44d067,_0x52a3da){let _0x5ea291=this['_getSlideModel'](_0x44d067);if(!_0x5ea291)return;let _0x16b812=new Set(_0x52a3da),_0x49b407=(0x0,x['resolveMatchingSlideElementPermissionObjectIds'])(_0x5ea291,_0x18914a=>_0x18914a['type']===x['PageElementTypeEnum']['Chart']&&_0x16b812['has'](_0x18914a['chartId']));this['add'](_0x49b407);}['_assertPage'](_0x12cfb1,_0x3e688b,_0xbdde2d){if(_0xbdde2d){this['_assertElement'](_0x12cfb1,_0x3e688b,_0xbdde2d);return;}let _0x38274e=this['_getSlideModel'](_0x12cfb1);if(!_0x38274e)return;let _0x4d881a=(0x0,x['getSlidePageType'])(_0x38274e,_0x3e688b),_0x33ca44=[];_0x4d881a===x['PageTypeEnum']['Slide']?_0x33ca44['push']((0x0,x['getSlidePagePermissionObjectId'])(_0x3e688b)):(_0x4d881a===x['PageTypeEnum']['Master']||_0x4d881a===x['PageTypeEnum']['Layout'])&&_0x33ca44['push'](x['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']),this['add'](_0x33ca44);}['_assertElement'](_0x385f29,_0x1f1717,_0x292352){let _0x51c123=this['_getSlideModel'](_0x385f29);if(!_0x51c123)return;let _0x188177=(0x0,x['getSlidePageType'])(_0x51c123,_0x1f1717)??x['PageTypeEnum']['Slide'],_0x31dc0f=new Set();(0x0,x['addSlideElementPermissionObjectIds'])(_0x51c123,_0x1f1717,_0x188177,new Set([_0x292352]),_0x31dc0f),this['add'](_0x31dc0f);}},Yt=class{['model'];['targets']=new Set();constructor(_0x51c283){this['model']=_0x51c283;}['collect'](_0x11c21c){return this['_checkPresentationMutation'](_0x11c21c),this['_checkPageMutation'](_0x11c21c),this['_checkElementMutation'](_0x11c21c),this['_checkDrawingMutation'](_0x11c21c),this['targets'];}['add'](_0x470d77){for(let _0x498400 of _0x470d77)this['targets']['add'](_0x498400);}['_checkPresentationMutation'](_0x3afc47){switch(_0x3afc47['id']){case x['EnsureSlideMasterPageMutation']['id']:{let _0x135655=_0x3afc47['params'];return _0x135655&&this['_assertPageSnapshot'](_0x135655['unitId'],_0x135655['masterPage']),!0x0;}case'slide.mutation.set-name':{let _0x4cc54d=_0x3afc47['params'];return _0x4cc54d&&this['_assertUnit'](_0x4cc54d['unitId']),!0x0;}case x['SetSlidePageSizeMutation']['id']:{let _0x12f94b=_0x3afc47['params'];return _0x12f94b&&this['_assertOptionalPage'](_0x12f94b['unitId'],_0x12f94b['pageId']),!0x0;}case x['SetPresentationBackgroundGraphicsMutation']['id']:{let _0xee5cb6=_0x3afc47['params'];return _0xee5cb6&&this['_assertMasterView'](_0xee5cb6['unitId']),!0x0;}case x['SetSlideTransitionMutation']['id']:{let _0x36b0e0=_0x3afc47['params'];return _0x36b0e0&&this['_assertPages'](_0x36b0e0['unitId'],Object['keys'](_0x36b0e0['slideTransitionRefs']??{})),!0x0;}default:return!0x1;}}['_checkPageMutation'](_0x6aeb16){switch(_0x6aeb16['id']){case x['AddSlidePageMutation']['id']:{let _0xfb247a=_0x6aeb16['params'];return _0xfb247a&&this['_assertPageSnapshot'](_0xfb247a['unitId'],_0xfb247a['slide']),!0x0;}case x['MoveSlidePageMutation']['id']:{let _0x2393d1=_0x6aeb16['params'];return _0x2393d1&&this['_assertPage'](_0x2393d1['unitId'],_0x2393d1['subUnitId']),!0x0;}case x['RemoveSlidePageMutation']['id']:{let _0x231294=_0x6aeb16['params'];return _0x231294&&this['_assertPageWithElements'](_0x231294['unitId'],_0x231294['subUnitId']),!0x0;}case'slide.mutation.set-slide-placeholder-suppression':{let _0x4f63b6=_0x6aeb16['params'];return _0x4f63b6&&this['_assertPage'](_0x4f63b6['unitId'],_0x4f63b6['subUnitId']),!0x0;}case x['SetSlideSpeakerNotesMutation']['id']:{let _0x591daf=_0x6aeb16['params'];return _0x591daf&&this['_assertPage'](_0x591daf['unitId'],_0x591daf['subUnitId']),!0x0;}case x['UpdateSlidePageBackgroundMutation']['id']:{let _0xdde460=_0x6aeb16['params'];return _0xdde460&&this['_assertPage'](_0xdde460['unitId'],_0xdde460['pageId']),!0x0;}default:return!0x1;}}['_checkElementMutation'](_0x2b96f0){switch(_0x2b96f0['id']){case x['AddSlideElementMutation']['id']:{let _0x3f1c7d=_0x2b96f0['params'];return _0x3f1c7d&&this['_assertElements'](_0x3f1c7d['unitId'],_0x3f1c7d['subUnitId'],[_0x3f1c7d['element']['id']],_0x3f1c7d['sourcePageType']),!0x0;}case x['InsertDrawingObjectMutation']['id']:{let _0x138f79=_0x2b96f0['params'];return _0x138f79?.['drawings']['forEach'](_0x5e0747=>this['_assertElements'](_0x138f79['unitId'],_0x138f79['subUnitId'],[_0x5e0747['drawingId']],_0x5e0747['sourcePageType'])),!0x0;}case x['RemoveSlideElementMutation']['id']:{let _0x255f32=_0x2b96f0['params'];return _0x255f32&&this['_assertElements'](_0x255f32['unitId'],_0x255f32['subUnitId'],[_0x255f32['drawingId']]),!0x0;}case x['UpdateSlideElementMutation']['id']:{let _0x510830=_0x2b96f0['params'];return _0x510830&&!_0x510830['formulaLastValueGuard']&&this['_assertElements'](_0x510830['unitId'],_0x510830['subUnitId'],[_0x510830['drawingId']]),!0x0;}default:return!0x1;}}['_checkDrawingMutation'](_0x5b37c0){switch(_0x5b37c0['id']){case x['SetSlideDrawingApplyMutation']['id']:{let _0x173a70=_0x5b37c0['params'];return _0x173a70&&this['_assertElements'](_0x173a70['unitId'],_0x173a70['subUnitId'],_0x173a70['objects']['map'](_0x40b299=>_0x40b299['drawingId'])),!0x0;}case x['SetSlideElementOrderMutation']['id']:{let _0x4e5c74=_0x5b37c0['params'];return _0x4e5c74&&this['_assertElements'](_0x4e5c74['unitId'],_0x4e5c74['subUnitId'],_0x4e5c74['drawingIds']),!0x0;}case x['SetSlideGroupMutation']['id']:{let _0x181812=_0x5b37c0['params'];return _0x181812&&this['_assertElements'](_0x181812['unitId'],_0x181812['subUnitId'],_0x181812['drawingIds']),!0x0;}case x['CancelSlideGroupMutation']['id']:{let _0x3ce745=_0x5b37c0['params'];return _0x3ce745&&this['_assertElements'](_0x3ce745['unitId'],_0x3ce745['subUnitId'],_0x3ce745['drawingIds']),!0x0;}default:return!0x1;}}['_getSlideModel'](_0x4cf7b3){return _0x4cf7b3===this['model']['getUnitId']()?this['model']:void 0x0;}['_assertUnit'](_0x526146){this['_getSlideModel'](_0x526146)&&this['add']([]);}['_assertOptionalPage'](_0x38f806,_0x2eeadd){if(_0x2eeadd){this['_assertPage'](_0x38f806,_0x2eeadd);return;}this['_assertUnit'](_0x38f806);}['_assertPage'](_0x27e177,_0x537e2e,_0x435468){let _0x48087b=this['_getSlideModel'](_0x27e177);if(!_0x48087b)return;let _0x1af8c4=_0x435468??(0x0,x['getSlidePageType'])(_0x48087b,_0x537e2e),_0x17746c=new Set();this['_addPageTarget'](_0x537e2e,_0x1af8c4,_0x17746c),this['add'](_0x17746c);}['_assertPages'](_0x2b83f0,_0x335004){let _0x39090c=this['_getSlideModel'](_0x2b83f0);if(!_0x39090c)return;let _0x3cae50=new Set();_0x335004['forEach'](_0x22f273=>this['_addPageTarget'](_0x22f273,(0x0,x['getSlidePageType'])(_0x39090c,_0x22f273),_0x3cae50)),this['add'](_0x3cae50);}['_assertPageWithElements'](_0x5ebe16,_0x1defe8){let _0x39394a=this['_getSlideModel'](_0x5ebe16);if(!_0x39394a)return;let _0x363c32=_0x39394a['getSnapshot']()['slides'][_0x1defe8],_0x46deff=new Set();this['_addPageTarget'](_0x1defe8,(0x0,x['getSlidePageType'])(_0x39394a,_0x1defe8),_0x46deff),(0x0,x['addSlideElementPermissionObjectIds'])(_0x39394a,_0x1defe8,x['PageTypeEnum']['Slide'],new Set(Object['keys'](_0x363c32?.['elements']??{})),_0x46deff),this['add'](_0x46deff);}['_assertElements'](_0xc2f069,_0x13ecea,_0x2971fc,_0x3510aa){let _0x32392d=this['_getSlideModel'](_0xc2f069);if(!_0x32392d)return;let _0x9db00a=_0x3510aa??(0x0,x['getSlidePageType'])(_0x32392d,_0x13ecea)??x['PageTypeEnum']['Slide'],_0x13a914=new Set();(0x0,x['addSlideElementPermissionObjectIds'])(_0x32392d,_0x13ecea,_0x9db00a,new Set(_0x2971fc),_0x13a914),this['add'](_0x13a914);}['_assertMasterView'](_0x3b6657){this['_getSlideModel'](_0x3b6657)&&this['add']([x['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']]);}['_assertPageSnapshot'](_0x5ce6cf,_0x57bf10){if(!this['_getSlideModel'](_0x5ce6cf))return;let _0x4f59c5=new Set();this['_addPageTarget'](_0x57bf10['id'],_0x57bf10['pageType'],_0x4f59c5),Object['keys'](_0x57bf10['elements'])['forEach'](_0x2672ae=>{_0x4f59c5['add']((0x0,x['getSlideElementPermissionObjectId'])(_0x57bf10['pageType'],_0x57bf10['id'],_0x2672ae));}),this['add'](_0x4f59c5);}['_addPageTarget'](_0x13de5,_0x4107af,_0x56037e){_0x4107af===x['PageTypeEnum']['Master']||_0x4107af===x['PageTypeEnum']['Layout']?_0x56037e['add'](x['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']):_0x4107af===x['PageTypeEnum']['Slide']&&_0x56037e['add']((0x0,x['getSlidePagePermissionObjectId'])(_0x13de5));}},Xt=class{['model'];['targets']=new Set();constructor(_0xf3f7c4){this['model']=_0xf3f7c4;}['collect'](_0x362a01){return this['_checkTableMutation'](_0x362a01),this['targets'];}['add'](_0x2f6568){for(let _0x7135fd of _0x2f6568)this['targets']['add'](_0x7135fd);}['_checkTableMutation'](_0x2b7f99){switch(_0x2b7f99['id']){case S['RemoveSlideTableMutation']['id']:{let _0x3a3199=_0x2b7f99['params'];return _0x3a3199&&this['_assertTable'](_0x3a3199['unitId'],_0x3a3199['tableId']),!0x0;}case S['SetSlideTableMutation']['id']:{let _0x3a1787=_0x2b7f99['params'];return _0x3a1787&&this['_assertTable'](_0x3a1787['unitId'],_0x3a1787['table']['id']),!0x0;}default:return!0x1;}}['_getSlideModel'](_0x3922ba){return _0x3922ba===this['model']['getUnitId']()?this['model']:void 0x0;}['_assertTable'](_0x1c0d1e,_0xfcbd,_0x5e86de,_0x489b00){if(_0x5e86de&&_0x489b00){this['_assertElement'](_0x1c0d1e,_0x5e86de,_0x489b00);return;}let _0x561542=this['_getSlideModel'](_0x1c0d1e);if(!_0x561542)return;let _0x35aa22=(0x0,x['resolveMatchingSlideElementPermissionObjectIds'])(_0x561542,_0x3d33da=>_0x3d33da['type']===x['PageElementTypeEnum']['Table']&&_0x3d33da['tableId']===_0xfcbd);this['add'](_0x35aa22);}['_assertPage'](_0x580b50,_0x39463f,_0x253c01){if(_0x253c01){this['_assertElement'](_0x580b50,_0x39463f,_0x253c01);return;}let _0x1eec40=this['_getSlideModel'](_0x580b50);if(!_0x1eec40)return;let _0x1fcaa9=(0x0,x['getSlidePageType'])(_0x1eec40,_0x39463f),_0xa3993a=[];_0x1fcaa9===x['PageTypeEnum']['Slide']?_0xa3993a['push']((0x0,x['getSlidePagePermissionObjectId'])(_0x39463f)):(_0x1fcaa9===x['PageTypeEnum']['Master']||_0x1fcaa9===x['PageTypeEnum']['Layout'])&&_0xa3993a['push'](x['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']),this['add'](_0xa3993a);}['_assertElement'](_0x4bf11f,_0x57e2dd,_0xbb8366){let _0x58845d=this['_getSlideModel'](_0x4bf11f);if(!_0x58845d)return;let _0x15c923=(0x0,x['getSlidePageType'])(_0x58845d,_0x57e2dd)??x['PageTypeEnum']['Slide'],_0x488da0=new Set();(0x0,x['addSlideElementPermissionObjectIds'])(_0x58845d,_0x57e2dd,_0x15c923,new Set([_0xbb8366]),_0x488da0),this['add'](_0x488da0);}},Zt=new Set([y['AddCommentMutation']['id'],y['DeleteCommentMutation']['id'],y['ResolveCommentMutation']['id'],y['UpdateCommentMutation']['id'],y['UpdateCommentRefMutation']['id']]);function Qt(_0x39a569,_0x40dfbb,_0x3b5ac5){if(Zt['has'](_0x3b5ac5['id']))return[{'unitID':_0x40dfbb,'objectID':_0x40dfbb,'objectType':c['UnitObject']['Slide'],'action':c['UnitAction']['Comment']}];let _0x506d2e=_0x39a569['get'](u['IUniverInstanceService'])['getUnit'](_0x40dfbb,u['UniverInstanceType']['UNIVER_SLIDE']),_0x4b3952=new Set([...new Yt(_0x506d2e)['collect'](_0x3b5ac5),...new Jt(_0x506d2e,_0x39a569['get'](b['SlideChartResourceService']))['collect'](_0x3b5ac5),...new Xt(_0x506d2e)['collect'](_0x3b5ac5)]);return _0x4b3952['size']===0x0?[]:D(_0x40dfbb,_0x4b3952,qt(_0x39a569,_0x40dfbb));}var $t={[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']},en=class{['_handle'];['_requirements']=new Map();['_injector'];constructor(_0x2a0e49,_0x44a939){this['_handle']=_0x44a939,this['_injector']=_0x2a0e49['__getInjector']();}['collect'](_0x4fb641){let {unitID:_0x3a7989,type:_0x6c4395}=this['_handle'],_0x27257e=_0x4fb641['params'];if(_0x27257e?.['unitId']!==void 0x0&&_0x27257e['unitId']!==_0x3a7989)throw new C('INVALID_REQUEST','Mutation\x20identifies\x20another\x20Unit');let _0x26c1e3=$t[_0x6c4395];if(_0x26c1e3!==void 0x0){this['_add']({'unitID':_0x3a7989,'objectID':_0x3a7989,'objectType':_0x26c1e3,'action':c['UnitAction']['Edit']});for(let _0x495a0d of this['_collectUnitPermissions'](_0x4fb641))this['_add'](_0x495a0d);}}['finish'](){return[...this['_requirements']['values']()];}['_collectUnitPermissions'](_0x374f7e){let {unitID:_0x30e48f,type:_0x368c00}=this['_handle'];switch(_0x368c00){case c['UniverType']['UNIVER_SHEET']:return Gt(this['_injector'],_0x30e48f,_0x374f7e);case c['UniverType']['UNIVER_DOC']:return Rt(this['_injector'],_0x30e48f,_0x374f7e);case c['UniverType']['UNIVER_SLIDE']:return Qt(this['_injector'],_0x30e48f,_0x374f7e);case c['UniverType']['UNIVER_BOARD']:return vt(this['_injector'],_0x30e48f,_0x374f7e);case c['UniverType']['UNIVER_BASE']:return ft(this['_injector'],_0x30e48f,_0x374f7e);default:return[];}}['_add'](_0x411315){let {unitID:_0x2297ae,objectID:_0x5394b1,objectType:_0x39bba0,action:_0x11711c}=_0x411315,_0x48c148=JSON['stringify']([_0x2297ae,_0x5394b1,_0x39bba0,_0x11711c]);this['_requirements']['set'](_0x48c148,_0x411315);}},tn=class{['_transformService'];constructor(_0x29742d){this['_transformService']=_0x29742d;}['parseClient'](_0x296334){try{return(0x0,l['parseProtocolChangeset'])(structuredClone(_0x296334));}catch(_0x474655){throw new C('INVALID_REQUEST','Changeset\x20is\x20malformed',{'cause':_0x474655});}}['transform'](_0x2d295c,_0x286bd5){let _0x4c0905;try{_0x4c0905=_0x286bd5['map'](_0x9c56bf=>(0x0,l['parseProtocolChangeset'])(structuredClone(_0x9c56bf)));}catch(_0x5df585){throw new C('ADAPTER_FAILURE','Stored\x20changeset\x20cannot\x20be\x20parsed',{'retryable':!0x0,'cause':_0x5df585});}let _0xd219a0=_0x2d295c;if(_0x4c0905['length']>0x0){let _0x42a16c=this['_transformService']['transformChangesets'](_0x4c0905,[_0x2d295c],!0x1);if((0x0,l['isTransformChangesetsFailure'])(_0x42a16c)||!_0x42a16c['c2Prime'][0x0])throw new C('OT_CONFLICT','Changeset\x20cannot\x20be\x20transformed',{'cause':(0x0,l['isTransformChangesetsFailure'])(_0x42a16c)?_0x42a16c['error']:void 0x0});_0xd219a0=_0x42a16c['c2Prime'][0x0];}try{return(0x0,l['parseChangesetToProtocol'])(_0xd219a0);}catch(_0x4324bf){throw new C('INTERNAL_ERROR','Transformed\x20changeset\x20cannot\x20be\x20serialized',{'retryable':!0x0,'cause':_0x4324bf});}}},nn=new WeakSet();function rn(_0x34d4b5){if(!nn['has'](_0x34d4b5)){for(let _0xccfee9 of[an,on])_0x34d4b5['hasCommand'](_0xccfee9['id'])&&_0x34d4b5['unregisterCommand'](_0xccfee9['id']),_0x34d4b5['registerCommand'](_0xccfee9);nn['add'](_0x34d4b5);}}var an={'id':'doc.mutation.rich-text-editing','type':u['CommandType']['MUTATION'],'handler'(_0x2d16b2,_0x30e096){let _0x5082b8=_0x2d16b2['get'](u['IUniverInstanceService'])['getUnit'](_0x30e096['unitId'],u['UniverInstanceType']['UNIVER_DOC']);if(!_0x5082b8)return!0x1;if(!_0x30e096['actions']||u['JSONX']['isNoop'](_0x30e096['actions']))return!0x0;let _0xa564c5=_0x5082b8['getSnapshot'](),_0x261b61=u['JSONX']['invertWithDoc'](_0x30e096['actions'],_0xa564c5);_0x5082b8['apply'](_0x30e096['actions']);let _0x4043ae=(0x0,l['validateDocumentAfterApply'])(_0x5082b8['getSnapshot']());if(!_0x4043ae['ok'])throw _0x5082b8['apply'](_0x261b61),Error('Invalid\x20Doc\x20mutation\x20result:\x20'+_0x4043ae['errors']['join']('\x20'));return!0x0;}},on={'id':'doc.mutation.rename-doc','type':u['CommandType']['MUTATION'],'handler'(_0x4fdb30,_0x4558f9){if(!_0x4558f9)return!0x1;let _0x4d191e=_0x4fdb30['get'](u['IUniverInstanceService'])['getUnit'](_0x4558f9['unitId'],u['UniverInstanceType']['UNIVER_DOC']);return _0x4d191e?(_0x4d191e['setName'](_0x4558f9['name']),!0x0):!0x1;}},sn={'code':c['ErrorCode']['OK'],'message':''},cn=class{['_reader'];['_contexts']=new WeakMap();['_capture']=new te['AsyncLocalStorage']();constructor(_0x294f3b){this['_reader']=_0x294f3b;}['createContext'](_0x16efa8,_0x528a4b){let _0x345fd6={};return this['_contexts']['set'](_0x345fd6,{'databaseContext':_0x16efa8,..._0x528a4b?{'snapshot':_0x528a4b}:{}}),_0x345fd6;}async['capture'](_0xeb18b9){let _0x3166ff={'sheetBlocks':[]};return{'result':await this['_capture']['run'](_0x3166ff,_0xeb18b9),..._0x3166ff['snapshot']?{'snapshot':_0x3166ff['snapshot']}:{},'sheetBlocks':_0x3166ff['sheetBlocks']};}async['getUnitOnRev'](_0x2d46c1,_0x4c8e7f){let _0x3085bf=this['_requireBinding'](_0x2d46c1),_0x4fe025=_0x3085bf['snapshot']?.['unitID']===_0x4c8e7f['unitID']&&_0x3085bf['snapshot']['type']===_0x4c8e7f['type']&&_0x3085bf['snapshot']['rev']===_0x4c8e7f['revision']?_0x3085bf['snapshot']:await this['_database'](()=>this['_reader']['getSnapshot'](_0x3085bf['databaseContext'],_0x4c8e7f['unitID'],{'revision':_0x4c8e7f['revision']}));if(!_0x4fe025)throw G('Stored\x20Unit\x20snapshot\x20is\x20missing');if(_0x4fe025['unitID']!==_0x4c8e7f['unitID']||_0x4fe025['type']!==_0x4c8e7f['type']||!Number['isSafeInteger'](_0x4fe025['rev'])||_0x4fe025['rev']<0x1||_0x4fe025['rev']>_0x4c8e7f['revision']||!ln(_0x4fe025))throw G('Stored\x20Unit\x20snapshot\x20is\x20invalid');let _0x11ef4b=await this['_database'](()=>this['_reader']['getChangesets'](_0x3085bf['databaseContext'],_0x4c8e7f['unitID'],{'from':_0x4fe025['rev'],'to':_0x4c8e7f['revision']}));if(_0x11ef4b===null)throw G('Stored\x20Unit\x20is\x20unavailable');return un(_0x4c8e7f,_0x4fe025,_0x11ef4b),{'error':void 0x0,'snapshot':_0x4fe025,'changesets':[..._0x11ef4b]};}async['getSheetBlock'](_0x322f2f,_0x220c89){let _0x370e05=await this['_database'](()=>this['_reader']['getSheetBlock'](this['_requireContext'](_0x322f2f),_0x220c89['unitID'],_0x220c89['blockID']));if(!_0x370e05)throw G('Stored\x20Sheet\x20block\x20'+_0x220c89['blockID']+'\x20is\x20missing');return{'error':void 0x0,'block':_0x370e05};}['getDeserializedSheetBlock'](_0x510cf3,_0x45acd7){return this['getSheetBlock'](_0x510cf3,_0x45acd7);}async['fetchMissingChangesets'](_0x14e3b0,_0xe5ae9c){let _0x394f45=await this['_database'](()=>this['_reader']['getChangesets'](this['_requireContext'](_0x14e3b0),_0xe5ae9c['unitID'],{'from':_0xe5ae9c['from'],..._0xe5ae9c['to']===0x0?{}:{'to':_0xe5ae9c['to']}}));if(_0x394f45===null)throw G('Stored\x20Unit\x20is\x20unavailable');return{'error':void 0x0,'changesets':[..._0x394f45]};}['getResourcesRequest'](_0x3da213,_0x4c059e){return Promise['resolve']({'error':void 0x0,'resources':{}});}async['saveSnapshot'](_0x6f482c,_0x4c636b){let _0x45730e=this['_requireCapture']();if(!_0x4c636b['snapshot'])throw Error('SnapshotService\x20attempted\x20to\x20save\x20an\x20empty\x20snapshot');return _0x45730e['snapshot']=_0x4c636b['snapshot'],{'error':sn};}['updateSnapshot'](_0x49f054,_0x4cbe0c){return this['saveSnapshot'](_0x49f054,_0x4cbe0c);}async['saveSheetBlock'](_0x513a44,_0x5e858f){let _0x3db05e=this['_requireCapture']();if(!_0x5e858f['block'])throw Error('SnapshotService\x20attempted\x20to\x20save\x20an\x20empty\x20Sheet\x20block');return _0x3db05e['sheetBlocks']['push'](_0x5e858f['block']),{'error':sn,'blockID':_0x5e858f['block']['id']};}['saveChangeset'](_0xcc393e,_0x36b8c4){return W('saveChangeset');}['copyFileMeta'](_0x8f19e5,_0x69f518){return W('copyFileMeta');}['getLatestCsReqIdBySid'](_0xafcdea,_0x2d96f2){return W('getLatestCsReqIdBySid');}['_requireBinding'](_0x3b9d8c){let _0x466c2a=this['_contexts']['get'](_0x3b9d8c);if(!_0x466c2a)throw Error('Snapshot\x20operation\x20is\x20missing\x20its\x20Database\x20context');return _0x466c2a;}['_requireContext'](_0xcc865){return this['_requireBinding'](_0xcc865)['databaseContext'];}['_requireCapture'](){let _0x55dff0=this['_capture']['getStore']();if(!_0x55dff0)throw Error('Snapshot\x20save\x20was\x20called\x20outside\x20a\x20capture\x20operation');return _0x55dff0;}async['_database'](_0x17ed84){try{return await _0x17ed84();}catch(_0x35997a){throw _0x35997a instanceof C?_0x35997a:new C('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x35997a});}}};function W(_0x4fec42){return Promise['reject'](Error('SnapshotAdapterBridge\x20does\x20not\x20support\x20'+_0x4fec42));}function G(_0x22f88d){return new C('ADAPTER_FAILURE',_0x22f88d,{'retryable':!0x0});}function ln(_0x2a6a26){switch(_0x2a6a26['type']){case c['UniverType']['UNIVER_SHEET']:case c['UniverType']['UNIVER_BASE']:return _0x2a6a26['workbook']!==void 0x0;case c['UniverType']['UNIVER_DOC']:return _0x2a6a26['doc']!==void 0x0;case c['UniverType']['UNIVER_SLIDE']:return _0x2a6a26['slide']!==void 0x0;case c['UniverType']['UNIVER_BOARD']:return _0x2a6a26['board']!==void 0x0;default:return!0x1;}}function un(_0x267b30,_0x33cf4b,_0x2b6e1c){let _0x391c9a=_0x33cf4b['rev']+0x1;for(let _0x11db8c of _0x2b6e1c){if(_0x11db8c['unitID']!==_0x267b30['unitID']||_0x11db8c['type']!==_0x267b30['type']||_0x11db8c['baseRev']!==_0x391c9a-0x1||_0x11db8c['revision']!==_0x391c9a)throw G('Stored\x20changeset\x20history\x20is\x20not\x20contiguous');_0x391c9a+=0x1;}if(_0x391c9a-0x1!==_0x267b30['revision'])throw G('Stored\x20changeset\x20history\x20is\x20incomplete');}function dn(_0x39e336){_0x39e336['registerPlugin'](l['UniverCollaborationPlugin']),fn(_0x39e336),pn(_0x39e336),mn(_0x39e336),hn(_0x39e336),gn(_0x39e336),_n(_0x39e336);}function fn(_0xb8775a){_0xb8775a['registerPlugin'](y['UniverThreadCommentPlugin']),_0xb8775a['registerPlugin'](Se['UniverThreadCommentResourcePlugin']),_0xb8775a['registerPlugin'](Ee['UniverDrawingPlugin']),_0xb8775a['registerPlugin'](me['UniverEmbedPlugin']);}function pn(_0x100452){_0x100452['registerPlugin'](we['UniverDocsHyperLinkPlugin']),_0x100452['registerPlugin'](Ce['UniverDocsDrawingPlugin']),_0x100452['registerPlugin'](ce['UniverDocsCalloutPlugin']),_0x100452['registerPlugin'](le['UniverDocsChartPlugin']),_0x100452['registerPlugin'](ue['UniverDocsCodePlugin']),_0x100452['registerPlugin'](de['UniverDocsLatexPlugin']),_0x100452['registerPlugin'](fe['UniverDocsShapePlugin']),_0x100452['registerPlugin'](pe['UniverDocsTablePlugin']),_0x100452['registerPlugin'](Te['UniverDocsThreadCommentPlugin']);}function mn(_0x558feb){_0x558feb['registerPlugin'](h['UniverSheetsPlugin']),_0x558feb['registerPlugin'](he['UniverRustFormulaEnginePlugin'],{}),_0x558feb['registerPlugin'](Oe['UniverSheetsFormulaPlugin']),_0x558feb['registerPlugin'](g['UniverSheetsConditionalFormattingPlugin']),_0x558feb['registerPlugin'](_['UniverDataValidationPlugin']),_0x558feb['registerPlugin'](v['UniverSheetsFilterPlugin']),_0x558feb['registerPlugin'](ke['UniverSheetsHyperLinkPlugin']),_0x558feb['registerPlugin'](ve['UniverSheetsPivotTablePlugin']),_0x558feb['registerPlugin'](Me['UniverSheetsTablePlugin']),_0x558feb['registerPlugin'](_e['UniverSheetsOutlinePlugin']),_0x558feb['registerPlugin'](be['UniverSheetSparklinePlugin']),_0x558feb['registerPlugin'](De['UniverSheetsDrawingPlugin']),_0x558feb['registerPlugin'](je['UniverSheetsSortPlugin']),_0x558feb['registerPlugin'](ge['UniverSheetsChartPlugin']),_0x558feb['registerPlugin'](Ae['UniverSheetsNotePlugin']),_0x558feb['registerPlugin'](ye['UniverSheetsShapePlugin']),_0x558feb['registerPlugin'](Ne['UniverSheetsThreadCommentPlugin']);}function hn(_0x344fef){_0x344fef['registerPlugin'](x['UniverSlidesPlugin']),_0x344fef['registerPlugin'](b['UniverSlidesChartPlugin']),_0x344fef['registerPlugin'](S['UniverSlidesTablePlugin']),_0x344fef['registerPlugin'](xe['UniverSlidesThreadCommentPlugin']);}function gn(_0x5edc43){_0x5edc43['registerPlugin'](ee['UniverBoardsPlugin']),_0x5edc43['registerPlugin'](ie['UniverBoardsChartPlugin']),_0x5edc43['registerPlugin'](oe['UniverBoardsTablePlugin']),_0x5edc43['registerPlugin'](ae['UniverBoardsMindPlugin']),_0x5edc43['registerPlugin'](se['UniverBoardsThreadCommentPlugin']);}function _n(_0x47ab95){_0x47ab95['registerPlugin'](p['UniverBasesPlugin']),_0x47ab95['registerPlugin'](ne['UniverBaseDashboardPlugin'],{'notExecuteCalculation':!0x0}),_0x47ab95['registerPlugin'](re['UniverBasesThreadCommentPlugin']);}var vn=0x32,yn=0x2bf20,bn=0x7530,xn=class{['unitID'];['type'];['_revision'];constructor(_0x3bb447,_0x4ebb4b,_0x2fda11){this['unitID']=_0x3bb447,this['type']=_0x4ebb4b,this['_revision']=_0x2fda11;}get['revision'](){return this['_revision'];}['advanceTo'](_0xc5221a){this['_revision']=_0xc5221a;}},K=class{['changesetTransformer'];['_reader'];['_maxLoadedUnits'];['_idleTimeoutMs'];['_univer'];['_instanceService'];['_commandService'];['_revisionService'];['_compressMutationService'];['_snapshotService'];['_snapshotSaveService'];['_formulaCalculationSessionService'];['_snapshotBridge'];['_entries']=new Map();['_ensuring']=new Map();['_disposed']=!0x1;constructor(_0x219e31){if(this['_reader']=_0x219e31['reader'],this['_maxLoadedUnits']=_0x219e31['maxLoadedUnits']??vn,this['_idleTimeoutMs']=_0x219e31['idleTimeoutMs']??yn,!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 cn(this['_reader']);let _0x5ca688=this['_univer']['__getInjector']();_0x5ca688['add']([l['ISnapshotServerService'],{'useValue':this['_snapshotBridge']}]),_0x5ca688['add']([l['SnapshotSaveService']]),dn(this['_univer']),this['_instanceService']=_0x5ca688['get'](u['IUniverInstanceService']),this['_commandService']=_0x5ca688['get'](u['ICommandService']),this['_revisionService']=_0x5ca688['get'](l['RevisionService']),this['_compressMutationService']=_0x5ca688['get'](l['CompressMutationService']),this['changesetTransformer']=new tn(_0x5ca688['get'](l['ITransformService'])),this['_snapshotService']=_0x5ca688['get'](l['SnapshotService']),this['_snapshotSaveService']=_0x5ca688['get'](l['SnapshotSaveService']),this['_formulaCalculationSessionService']=_0x5ca688['get'](d['FormulaCalculationSessionService']);}['ensureUnit'](_0x54be61,_0x213668,_0x430cfa){this['_assertOpen']();let _0x46f7bc=this['_ensuring']['get'](_0x213668);if(_0x46f7bc)return _0x46f7bc['then'](_0x3e0339=>this['_retain'](_0x3e0339));let _0x59b2c1=this['_ensureUnit'](_0x54be61,_0x213668,_0x430cfa)['finally'](()=>{this['_ensuring']['get'](_0x213668)===_0x59b2c1&&this['_ensuring']['delete'](_0x213668);});return this['_ensuring']['set'](_0x213668,_0x59b2c1),_0x59b2c1['then'](_0x1462cc=>this['_adoptReservation'](_0x1462cc));}['releaseUnit'](_0x566fb9){let _0x3d84a8=this['_entries']['get'](_0x566fb9['unitID']);if(!(!_0x3d84a8||_0x3d84a8['handle']!==_0x566fb9)){if(_0x3d84a8['busy']<0x1)throw Error('Unit\x20Runtime\x20lease\x20was\x20released\x20more\x20than\x20once');--_0x3d84a8['busy'],this['_touch'](_0x3d84a8),this['_evictOverCapacity']();}}async['applyChangeset'](_0x2a6d8d,_0x2b90b9,_0x3a058f,_0x597171={}){this['_assertOpen']();let _0x4ce746=this['_requireEntry'](_0x2b90b9);return this['_withBusy'](_0x4ce746,async()=>{try{return await this['_applyConfirmedChangeset'](_0x2a6d8d,_0x4ce746['handle'],_0x3a058f,_0x597171);}catch(_0x484d86){throw this['disposeUnit'](_0x2b90b9['unitID']),_0x484d86 instanceof C?_0x484d86:new C('INTERNAL_ERROR','Failed\x20to\x20apply\x20changeset\x20to\x20Unit\x20Runtime',{'retryable':!0x0,'cause':_0x484d86});}});}async['createSnapshot'](_0x317d80){this['_assertOpen']();let _0x3e02af=this['_requireEntry'](_0x317d80);return this['_withBusy'](_0x3e02af,async()=>{try{let _0x2dc98c=await this['_snapshotBridge']['capture'](()=>this['_createProtocolSnapshot'](_0x3e02af['handle'])),_0x26dc01=_0x2dc98c['result']['snapshot']??_0x2dc98c['snapshot'];if(!_0x26dc01)throw Error('SDK\x20snapshot\x20generation\x20returned\x20no\x20snapshot');return{'snapshot':_0x26dc01,..._0x2dc98c['sheetBlocks']['length']>0x0?{'sheetBlocks':_0x2dc98c['sheetBlocks']}:{}};}catch(_0x12cd94){throw this['disposeUnit'](_0x317d80['unitID']),new C('INTERNAL_ERROR','Failed\x20to\x20create\x20Unit\x20Runtime\x20snapshot',{'retryable':!0x0,'cause':_0x12cd94});}});}['disposeUnit'](_0x215f18){let _0x3c156d=this['_entries']['get'](_0x215f18);_0x3c156d?.['idleTimer']&&clearTimeout(_0x3c156d['idleTimer']),this['_entries']['delete'](_0x215f18),this['_instanceService']['disposeUnit'](_0x215f18);}async['dispose'](){if(!this['_disposed']){this['_disposed']=!0x0;for(let _0x5a2059 of[...this['_entries']['keys']()])this['disposeUnit'](_0x5a2059);this['_ensuring']['clear'](),this['_univer']['dispose']();}}async['_ensureUnit'](_0x467425,_0x41954f,_0x5cf472){Sn(_0x41954f,_0x5cf472);let _0x2a8b24=await this['_database'](()=>this['_reader']['getUnit'](_0x467425,_0x41954f));if(!_0x2a8b24)throw new C('UNIT_NOT_FOUND','Unit\x20'+_0x41954f+'\x20does\x20not\x20exist');if(_0x2a8b24['unitID']!==_0x41954f)throw new C('ADAPTER_FAILURE','Stored\x20Unit\x20metadata\x20belongs\x20to\x20a\x20different\x20identity',{'retryable':!0x0});if(_0x2a8b24['type']!==_0x5cf472)throw new C('INVALID_REQUEST','Unit\x20type\x20does\x20not\x20match\x20the\x20stored\x20Unit');if(!Number['isSafeInteger'](_0x2a8b24['headRevision'])||_0x2a8b24['headRevision']<0x1)throw new C('ADAPTER_FAILURE','Stored\x20Unit\x20metadata\x20is\x20invalid',{'retryable':!0x0});let _0x12ad0f=this['_entries']['get'](_0x41954f);if(_0x12ad0f&&_0x12ad0f['handle']['type']!==_0x5cf472&&(this['disposeUnit'](_0x41954f),_0x12ad0f=void 0x0),_0x12ad0f&&_0x12ad0f['handle']['revision']>_0x2a8b24['headRevision']&&(this['disposeUnit'](_0x41954f),_0x12ad0f=void 0x0),_0x12ad0f)try{return await this['_withBusy'](_0x12ad0f,async()=>{_0x12ad0f['handle']['revision']<_0x2a8b24['headRevision']&&await this['_replayRange'](_0x467425,_0x12ad0f['handle'],_0x12ad0f['handle']['revision'],_0x2a8b24['headRevision']);},!0x1),_0x12ad0f['busy']+=0x1,_0x12ad0f['handle'];}catch{this['disposeUnit'](_0x41954f);}return this['_loadUnit'](_0x467425,_0x41954f,_0x5cf472,_0x2a8b24['headRevision']);}async['_loadUnit'](_0x5b9ecf,_0x37e410,_0x27cf84,_0x21d1a9){let _0x389025=await this['_database'](()=>this['_reader']['getSnapshot'](_0x5b9ecf,_0x37e410,{'revision':_0x21d1a9}));if(!_0x389025||_0x389025['unitID']!==_0x37e410||_0x389025['type']!==_0x27cf84||!Number['isSafeInteger'](_0x389025['rev'])||_0x389025['rev']<0x1||_0x389025['rev']>_0x21d1a9)throw new C('ADAPTER_FAILURE','Stored\x20Unit\x20snapshot\x20is\x20invalid',{'retryable':!0x0});try{if(await this['_loadSdkUnit'](_0x5b9ecf,_0x37e410,_0x27cf84,_0x389025['rev'],_0x389025),this['_revisionService']['getCurrentRevOfUnit'](_0x37e410)!==_0x389025['rev'])throw Error('SDK\x20loaded\x20Unit\x20at\x20an\x20unexpected\x20revision');let _0x93843f=new xn(_0x37e410,_0x27cf84,_0x389025['rev']),_0x5a4435={'handle':_0x93843f,'busy':0x1};if(this['_entries']['set'](_0x37e410,_0x5a4435),_0x389025['rev']<_0x21d1a9&&await this['_replayRange'](_0x5b9ecf,_0x93843f,_0x389025['rev'],_0x21d1a9),_0x93843f['revision']!==_0x21d1a9)throw Error('Runtime\x20did\x20not\x20reach\x20the\x20requested\x20revision');return _0x93843f;}catch(_0x4984a1){throw this['disposeUnit'](_0x37e410),_0x4984a1 instanceof C?_0x4984a1:new C('INTERNAL_ERROR','Failed\x20to\x20load\x20Unit\x20Runtime',{'retryable':!0x0,'cause':_0x4984a1});}}async['_loadSdkUnit'](_0x127bab,_0x3fe7b9,_0x141e25,_0xaea909,_0x1ba0bd){let _0x17f53e=this['_snapshotBridge']['createContext'](_0x127bab,_0x1ba0bd);switch(_0x141e25){case c['UniverType']['UNIVER_SHEET']:await this['_snapshotService']['loadSheet'](_0x3fe7b9,_0xaea909,_0x17f53e);return;case c['UniverType']['UNIVER_DOC']:await this['_snapshotService']['loadDoc'](_0x3fe7b9,_0xaea909,_0x17f53e),rn(this['_commandService']);return;case c['UniverType']['UNIVER_SLIDE']:await this['_snapshotService']['loadSlide'](_0x3fe7b9,_0xaea909,_0x17f53e);return;case c['UniverType']['UNIVER_BOARD']:await this['_snapshotService']['loadBoard'](_0x3fe7b9,_0xaea909,_0x17f53e);return;case c['UniverType']['UNIVER_BASE']:await this['_snapshotService']['loadBase'](_0x3fe7b9,_0xaea909,_0x17f53e);return;}throw Error('Unsupported\x20Unit\x20type:\x20'+_0x141e25);}async['_createProtocolSnapshot'](_0x41f442){let _0x33da9c={};switch(_0x41f442['type']){case c['UniverType']['UNIVER_SHEET']:{await this['_formulaCalculationSessionService']['waitForLatestApplied'](bn);let _0x20c6b6=this['_requireSdkUnit'](_0x41f442,u['UniverInstanceType']['UNIVER_SHEET']),_0x11569f=await this['_snapshotSaveService']['getSheet'](_0x33da9c,_0x41f442['unitID'],_0x41f442['revision'],_0x20c6b6);if(!_0x11569f['snapshot']['workbook'])throw Error('SDK\x20Sheet\x20snapshot\x20has\x20no\x20workbook\x20payload');return{..._0x11569f,'snapshot':{..._0x11569f['snapshot'],'workbook':{..._0x11569f['snapshot']['workbook'],'sheetOrder':_0x20c6b6['getSheets']()['map'](_0x23e880=>_0x23e880['getSheetId']())}}};}case c['UniverType']['UNIVER_DOC']:{let _0x47e513=this['_requireSdkUnit'](_0x41f442,u['UniverInstanceType']['UNIVER_DOC']);return this['_snapshotSaveService']['getDoc'](_0x33da9c,_0x41f442['unitID'],_0x41f442['revision'],_0x47e513);}case c['UniverType']['UNIVER_SLIDE']:{let _0x12ad2e=this['_requireSdkUnit'](_0x41f442,u['UniverInstanceType']['UNIVER_SLIDE']);return this['_snapshotService']['saveSlide'](_0x41f442['unitID'],_0x12ad2e['getSnapshot'](),_0x41f442['revision']);}case c['UniverType']['UNIVER_BOARD']:{let _0x4e1fd5=this['_requireSdkUnit'](_0x41f442,u['UniverInstanceType']['UNIVER_BOARD']);return this['_snapshotService']['saveBoard'](_0x41f442['unitID'],_0x4e1fd5['getSnapshot'](),_0x41f442['revision']);}case c['UniverType']['UNIVER_BASE']:{let _0x3ee437=this['_requireSdkUnit'](_0x41f442,u['UniverInstanceType']['UNIVER_BASE']);return this['_snapshotSaveService']['getBase'](_0x33da9c,_0x41f442['unitID'],_0x41f442['revision'],_0x3ee437);}}throw Error('Unsupported\x20Unit\x20type:\x20'+_0x41f442['type']);}['_requireSdkUnit'](_0x81aa0e,_0x1ccb4a){let _0x4dd632=this['_instanceService']['getUnit'](_0x81aa0e['unitID'],_0x1ccb4a);if(!_0x4dd632||this['_revisionService']['getCurrentRevOfUnit'](_0x81aa0e['unitID'])!==_0x81aa0e['revision'])throw Error('Runtime\x20Unit\x20or\x20revision\x20is\x20unavailable');return _0x4dd632;}async['_replayRange'](_0x432d4a,_0x382b1b,_0x54332a,_0x351555){let _0x472931=await this['_database'](()=>this['_reader']['getChangesets'](_0x432d4a,_0x382b1b['unitID'],{'from':_0x54332a,'to':_0x351555}));if(_0x472931===null)throw new C('ADAPTER_FAILURE','Unit\x20is\x20unavailable\x20during\x20replay',{'retryable':!0x0});let _0x2998b7=_0x54332a+0x1;for(let _0x408d99 of _0x472931){if(_0x408d99['unitID']!==_0x382b1b['unitID']||_0x408d99['type']!==_0x382b1b['type']||_0x408d99['baseRev']!==_0x2998b7-0x1||_0x408d99['revision']!==_0x2998b7)throw new C('ADAPTER_FAILURE','Stored\x20changeset\x20history\x20is\x20not\x20contiguous',{'retryable':!0x0});await this['_applyConfirmedChangeset'](_0x432d4a,_0x382b1b,_0x408d99),_0x2998b7+=0x1;}if(_0x2998b7-0x1!==_0x351555)throw new C('ADAPTER_FAILURE','Stored\x20changeset\x20history\x20is\x20incomplete',{'retryable':!0x0});}async['_applyConfirmedChangeset'](_0x571750,_0x24eddd,_0x220f4e,_0x1c2c10={}){if(_0x220f4e['unitID']!==_0x24eddd['unitID']||_0x220f4e['type']!==_0x24eddd['type']||_0x220f4e['baseRev']!==_0x24eddd['revision']||_0x220f4e['revision']!==_0x24eddd['revision']+0x1)throw Error('Changeset\x20does\x20not\x20follow\x20the\x20Runtime\x20revision');let _0x5095bb=(0x0,l['parseProtocolChangeset'])(_0x220f4e),_0x4c7114=_0x5095bb['mutations']['find'](_0x2310ad=>_0x2310ad['id']===l['RevertRevisionMutation']['id']);if(_0x4c7114){if(_0x5095bb['mutations']['length']!==0x1)throw new C('INVALID_REQUEST','A\x20restore\x20changeset\x20cannot\x20contain\x20other\x20mutations');let _0x267795=_0x4c7114['params'];if(_0x267795['unitId']!==_0x24eddd['unitID']||!Number['isSafeInteger'](_0x267795['revision'])||_0x267795['revision']<0x1||_0x267795['revision']>_0x220f4e['baseRev'])throw new C('INVALID_REQUEST','Restore\x20target\x20must\x20identify\x20an\x20existing\x20revision\x20of\x20this\x20Unit');let _0x52259a={'requiredUnitPermissions':[]};if(_0x1c2c10['collectUnitPermissions']){let _0x53db93=new en(this['_univer'],_0x24eddd),_0x3087d2=performance['now']();_0x53db93['collect'](_0x4c7114);let _0x2884b3=performance['now']()-_0x3087d2;_0x52259a={'requiredUnitPermissions':_0x53db93['finish'](),'permissionAnalysisDurationMs':_0x2884b3};}return await this['_restoreHistoricalRevision'](_0x571750,_0x24eddd,_0x220f4e,_0x267795['revision']),_0x52259a;}let _0x81936e=this['_compressMutationService']['interceptor']['fetchThroughInterceptors'](this['_compressMutationService']['interceptor']['getInterceptPoints']()['COMPRESS_MUTATION_APPLY'])(_0x5095bb['mutations'],null)??_0x5095bb['mutations'],_0x5d0f0d=this['_applyMutations'](_0x24eddd,_0x220f4e,_0x81936e,_0x1c2c10['collectUnitPermissions']===!0x0),_0x1867ff=this['_revisionService']['incrementRevOfUnit'](_0x24eddd['unitID']);if(_0x1867ff!==_0x220f4e['revision'])throw Error('Univer\x20Runtime\x20revision\x20did\x20not\x20advance\x20as\x20expected');return _0x24eddd['advanceTo'](_0x1867ff),_0x5d0f0d;}['_applyMutations'](_0x118b72,_0x92f045,_0x260f6c,_0x3feca3){if(!_0x3feca3)return this['_executeMutationBatch'](_0x92f045,_0x260f6c),{'requiredUnitPermissions':[]};let _0x27d1f5=new en(this['_univer'],_0x118b72),_0x36d8c6=0x0;for(let [_0x391e8a,_0x3ebea2]of _0x260f6c['entries']()){let _0x23bfcb=performance['now']();_0x27d1f5['collect'](_0x3ebea2),_0x36d8c6+=performance['now']()-_0x23bfcb,this['_executeMutationBatch'](_0x92f045,[_0x3ebea2],_0x391e8a);}return{'requiredUnitPermissions':_0x27d1f5['finish'](),'permissionAnalysisDurationMs':_0x36d8c6};}['_executeMutationBatch'](_0x41c7cc,_0x3c22b2,_0xecc0a7=0x0){let _0x5921a9=(0x0,u['sequenceExecute'])(_0x3c22b2,this['_commandService'],{'fromChangeset':!0x0});if(_0x5921a9['result'])return;let _0x34ebc1=_0x3c22b2[_0x5921a9['index']],_0x88c2f3=_0xecc0a7+_0x5921a9['index'];throw new C('INTERNAL_ERROR','Unit\x20Runtime\x20failed\x20to\x20execute\x20mutation\x20\x22'+_0x34ebc1['id']+'\x22\x20for\x20Unit\x20\x22'+_0x41c7cc['unitID']+'\x22\x20at\x20revision\x20'+_0x41c7cc['revision']+'\x20(index\x20'+_0x88c2f3+')',{'retryable':!0x0,'cause':_0x5921a9['error']});}async['_restoreHistoricalRevision'](_0x25a129,_0x77473e,_0x1b48af,_0xafed63){let _0x117558=await this['_database'](()=>this['_reader']['getSnapshot'](_0x25a129,_0x77473e['unitID'],{'revision':_0xafed63}));if(!_0x117558||_0x117558['unitID']!==_0x77473e['unitID']||_0x117558['type']!==_0x77473e['type']||!Number['isSafeInteger'](_0x117558['rev'])||_0x117558['rev']<0x1||_0x117558['rev']>_0xafed63)throw new C('ADAPTER_FAILURE','Stored\x20restore\x20snapshot\x20is\x20invalid',{'retryable':!0x0});this['_instanceService']['disposeUnit'](_0x77473e['unitID']),await this['_loadSdkUnit'](_0x25a129,_0x77473e['unitID'],_0x77473e['type'],_0x117558['rev'],_0x117558);let _0x12be4c=new xn(_0x77473e['unitID'],_0x77473e['type'],_0x117558['rev']);if(_0x12be4c['revision']<_0xafed63&&await this['_replayRange'](_0x25a129,_0x12be4c,_0x12be4c['revision'],_0xafed63),_0x12be4c['revision']!==_0xafed63)throw new C('ADAPTER_FAILURE','Restore\x20history\x20did\x20not\x20reach\x20its\x20target\x20revision',{'retryable':!0x0});if(this['_revisionService']['setRevOfUnit'](_0x77473e['unitID'],_0x1b48af['revision']),this['_revisionService']['getCurrentRevOfUnit'](_0x77473e['unitID'])!==_0x1b48af['revision'])throw Error('Univer\x20Runtime\x20did\x20not\x20adopt\x20the\x20restored\x20revision');_0x77473e['advanceTo'](_0x1b48af['revision']);}['_requireEntry'](_0x351d91){let _0x918a9a=this['_entries']['get'](_0x351d91['unitID']);if(!_0x918a9a||_0x918a9a['handle']!==_0x351d91||_0x918a9a['handle']['type']!==_0x351d91['type'])throw new C('INTERNAL_ERROR','Unit\x20Runtime\x20handle\x20is\x20stale',{'retryable':!0x0});return _0x918a9a;}async['_withBusy'](_0x2792e0,_0x1ef1da,_0xb5a996=!0x0){_0x2792e0['busy']+=0x1,_0x2792e0['idleTimer']&&(clearTimeout(_0x2792e0['idleTimer']),delete _0x2792e0['idleTimer']);try{return await _0x1ef1da();}finally{--_0x2792e0['busy'],_0xb5a996&&this['_entries']['get'](_0x2792e0['handle']['unitID'])===_0x2792e0&&(this['_touch'](_0x2792e0),this['_evictOverCapacity']());}}['_retain'](_0x8d1098){let _0x3b0cc3=this['_entries']['get'](_0x8d1098['unitID']);if(!_0x3b0cc3||_0x3b0cc3['handle']!==_0x8d1098)throw new C('INTERNAL_ERROR','Unit\x20Runtime\x20was\x20disposed\x20before\x20its\x20lease\x20could\x20be\x20acquired',{'retryable':!0x0});return _0x3b0cc3['busy']+=0x1,this['_touch'](_0x3b0cc3),this['_evictOverCapacity'](),_0x8d1098;}['_adoptReservation'](_0x5dd9c5){let _0x5b43fb=this['_entries']['get'](_0x5dd9c5['unitID']);if(!_0x5b43fb||_0x5b43fb['handle']!==_0x5dd9c5||_0x5b43fb['busy']<0x1)throw new C('INTERNAL_ERROR','Unit\x20Runtime\x20load\x20reservation\x20is\x20unavailable',{'retryable':!0x0});return this['_touch'](_0x5b43fb),this['_evictOverCapacity'](),_0x5dd9c5;}['_touch'](_0x6a2f8){let {unitID:_0xa2b580}=_0x6a2f8['handle'];if(_0x6a2f8['idleTimer']&&clearTimeout(_0x6a2f8['idleTimer']),this['_entries']['delete'](_0xa2b580),this['_entries']['set'](_0xa2b580,_0x6a2f8),_0x6a2f8['busy']>0x0){delete _0x6a2f8['idleTimer'];return;}_0x6a2f8['idleTimer']=setTimeout(()=>{_0x6a2f8['busy']===0x0&&this['_entries']['get'](_0xa2b580)===_0x6a2f8&&this['disposeUnit'](_0xa2b580);},this['_idleTimeoutMs']),_0x6a2f8['idleTimer']['unref']?.();}['_evictOverCapacity'](){for(;this['_entries']['size']>this['_maxLoadedUnits'];){let _0xd6d13d=[...this['_entries']['values']()]['find'](_0x1a3060=>_0x1a3060['busy']===0x0);if(!_0xd6d13d)return;this['disposeUnit'](_0xd6d13d['handle']['unitID']);}}async['_database'](_0x5e5083){try{return await _0x5e5083();}catch(_0x2f8831){throw _0x2f8831 instanceof C?_0x2f8831:new C('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x2f8831});}}['_assertOpen'](){if(this['_disposed'])throw new C('INTERNAL_ERROR','Unit\x20Runtime\x20is\x20disposed',{'retryable':!0x0});}};function Sn(_0x3e653f,_0x303b69){if(!_0x3e653f)throw new C('INVALID_REQUEST','unitID\x20is\x20required');if(!Cn['has'](_0x303b69))throw new C('INVALID_REQUEST','Unsupported\x20Unit\x20type:\x20'+_0x303b69);}var Cn=new Set([c['UniverType']['UNIVER_SHEET'],c['UniverType']['UNIVER_DOC'],c['UniverType']['UNIVER_SLIDE'],c['UniverType']['UNIVER_BOARD'],c['UniverType']['UNIVER_BASE']]),wn=class{['_options'];constructor(_0x98aff4){this['_options']=_0x98aff4;}async['submit'](_0x3a7bac,_0x5f54e6){let _0x2cc4fb=_0x5f54e6['changeset'];Tn(_0x2cc4fb);let _0x53a3bd={..._0x3a7bac,'request':_0x5f54e6};try{return await this['_options']['coordinator']['runExclusive'](_0x2cc4fb['unitID'],async()=>{let _0x48ce6b=this['_options']['maxRevisionRetries']+0x1;for(let _0x43f557=0x1;_0x43f557<=_0x48ce6b;_0x43f557+=0x1){let _0x29a6f1=await this['_attempt'](_0x53a3bd,_0x3a7bac,_0x5f54e6,_0x2cc4fb,_0x43f557);if(_0x29a6f1['status']!=='retry-attempt')return _0x29a6f1;}throw this['_options']['runtime']['disposeUnit'](_0x2cc4fb['unitID']),new C('REVISION_MISMATCH','Changeset\x20could\x20not\x20be\x20committed\x20after\x20bounded\x20retries',{'retryable':!0x0});});}catch(_0xb52b29){throw _0xb52b29 instanceof C&&_0xb52b29['code']==='UNIT_NOT_FOUND'&&this['_options']['runtime']['disposeUnit'](_0x2cc4fb['unitID']),_0xb52b29;}}async['_attempt'](_0x5bed62,_0x26875f,_0x17ebda,_0x71c219,_0x2f246f){let _0x32827e=await this['_measure']('load',()=>this['_options']['runtime']['ensureUnit'](_0x5bed62,_0x71c219['unitID'],_0x71c219['type']));try{let _0x5c175c=_0x32827e['revision'];if(_0x71c219['baseRev']>_0x5c175c)throw new C('REVISION_MISMATCH','Changeset\x20base\x20revision\x20is\x20ahead\x20of\x20the\x20Unit\x20head');let _0x3b535c=await this['_getHistory'](_0x5bed62,_0x71c219['unitID'],_0x71c219['type'],_0x71c219['baseRev'],_0x5c175c),_0x419c32=On(_0x3b535c,_0x71c219);if(_0x419c32)return Dn(_0x419c32,_0x71c219),q(_0x419c32)&&await this['_ensureRestoreSnapshot'](_0x5bed62,_0x32827e,_0x419c32)?(await this['_options']['onCommitted'](_0x26875f,_0x17ebda,_0x419c32,[]),{'status':'committed','changeset':_0x419c32}):{'status':'already-committed','changeset':_0x419c32};let _0xaa8955=await this['_measure']('transform',async()=>this['_createCandidate'](_0x71c219,_0x3b535c,_0x5c175c)),_0x360d2f=[],_0x36afe3=!0x1;try{let _0x3da2ca={'userID':_0x26875f['userID'],'memberID':_0x26875f['memberID'],'customData':_0x26875f['customData'],'request':_0x17ebda,'attempt':_0x2f246f,'currentRevision':_0x5c175c,'changeset':_0xaa8955};await this['_measure']('applyMiddleware',()=>this['_options']['middleware']['run']('applyChangeset',_0x3da2ca,async()=>{let _0x480c6d=await this['_measure']('executeMutations',()=>this['_options']['runtime']['applyChangeset'](_0x5bed62,_0x32827e,_0xaa8955,{'collectUnitPermissions':this['_options']['enableUnitPermissionAnalysis']===!0x0}));_0x360d2f=_0x480c6d['requiredUnitPermissions'];let _0x5836b7=_0x480c6d['permissionAnalysisDurationMs'];_0x5836b7!==void 0x0&&this['_options']['metrics']['observe']('collaboration.submit.duration',_0x5836b7,{'stage':'unitPermissionAnalysis'}),_0x36afe3=!0x0;}));let _0xec8f4d=await this['_runCommitMiddleware'](_0x5bed62,_0x26875f,_0x17ebda,_0xaa8955,_0x2f246f,_0x5c175c,_0x360d2f);if(!_0xec8f4d)return this['_options']['runtime']['disposeUnit'](_0x71c219['unitID']),{'status':'retry-attempt'};switch(_0xec8f4d['status']){case'revision-mismatch':if(!Number['isSafeInteger'](_0xec8f4d['actualHeadRevision'])||_0xec8f4d['actualHeadRevision']<0x1)throw Y('Database\x20returned\x20an\x20invalid\x20head\x20revision\x20mismatch');return this['_options']['runtime']['disposeUnit'](_0x71c219['unitID']),this['_options']['metrics']['increment']('collaboration.submit.retry',{'reason':'revision-mismatch'}),{'status':'retry-attempt'};case'recovered-committed':return q(_0xec8f4d['changeset'])?(await this['_ensureRestoreSnapshot'](_0x5bed62,_0x32827e,_0xec8f4d['changeset']),await this['_options']['onCommitted'](_0x26875f,_0x17ebda,_0xec8f4d['changeset'],_0x360d2f),{'status':'committed','changeset':_0xec8f4d['changeset']}):(this['_options']['runtime']['disposeUnit'](_0x71c219['unitID']),await this['_options']['onCommitted'](_0x26875f,_0x17ebda,_0xec8f4d['changeset'],_0x360d2f),await this['_snapshotBestEffort'](_0x5bed62,void 0x0,_0xec8f4d['changeset']),{'status':'committed','changeset':_0xec8f4d['changeset']});case'committed':return Dn(_0xec8f4d['changeset'],_0xaa8955,!0x0),q(_0xec8f4d['changeset'])?(await this['_ensureRestoreSnapshot'](_0x5bed62,_0x32827e,_0xec8f4d['changeset']),await this['_options']['onCommitted'](_0x26875f,_0x17ebda,_0xec8f4d['changeset'],_0x360d2f),{'status':'committed','changeset':_0xec8f4d['changeset']}):(await this['_options']['onCommitted'](_0x26875f,_0x17ebda,_0xec8f4d['changeset'],_0x360d2f),await this['_snapshotBestEffort'](_0x5bed62,_0x32827e,_0xec8f4d['changeset']),{'status':'committed','changeset':_0xec8f4d['changeset']});}}catch(_0x2885be){throw _0x36afe3&&this['_options']['runtime']['disposeUnit'](_0x71c219['unitID']),_0x2885be;}}finally{this['_options']['runtime']['releaseUnit'](_0x32827e);}}async['_runCommitMiddleware'](_0x352e10,_0x4f178d,_0x38e7c0,_0x931b1a,_0x1defe2,_0x1b102d,_0x1d41b0){let _0x40b758,_0x1bce23,_0x5e37a3={'userID':_0x4f178d['userID'],'memberID':_0x4f178d['memberID'],'customData':_0x4f178d['customData'],'request':_0x38e7c0,'attempt':_0x1defe2,'expectedHeadRevision':_0x1b102d,'changeset':_0x931b1a,'requiredUnitPermissions':_0x1d41b0};try{await this['_measure']('commitMiddleware',()=>this['_options']['middleware']['run']('commitChangeset',_0x5e37a3,async()=>{try{_0x40b758=await this['_measure']('databaseCommit',()=>this['_database'](()=>this['_options']['dbAdapter']['commitChangeset'](_0x352e10,{'changeset':_0x931b1a})));}catch(_0x324a69){throw _0x1bce23=_0x324a69,_0x324a69;}}));}catch(_0x4d6e2e){if(_0x40b758)return this['_options']['logger']['error']('commitChangeset\x20middleware\x20failed\x20after\x20database\x20commit',{'error':An(_0x4d6e2e)}),_0x40b758;if(!_0x1bce23)throw _0x4d6e2e;if(_0x1bce23 instanceof C&&!_0x1bce23['retryable'])throw _0x1bce23;}if(_0x40b758)return _0x40b758;let _0x4d2d32=On(await this['_getHistoryToLatest'](_0x352e10,_0x931b1a['unitID'],_0x931b1a['type'],_0x1b102d),_0x931b1a);return _0x4d2d32?(Dn(_0x4d2d32,_0x931b1a),{'status':'recovered-committed','changeset':_0x4d2d32}):(this['_options']['metrics']['increment']('collaboration.submit.retry',{'reason':'unknown-commit'}),null);}async['_getHistory'](_0x16a312,_0x20f575,_0x3cf976,_0x410d39,_0x2362cd){if(_0x410d39===_0x2362cd)return[];let _0xaf9561=await this['_database'](()=>this['_options']['dbAdapter']['getChangesets'](_0x16a312,_0x20f575,{'from':_0x410d39,'to':_0x2362cd}));if(_0xaf9561===null)throw Y('Unit\x20is\x20unavailable\x20while\x20reading\x20changeset\x20history');let _0x93f3ed=_0x410d39+0x1;for(let _0x4e5539 of _0xaf9561){if(_0x4e5539['unitID']!==_0x20f575||_0x4e5539['type']!==_0x3cf976||_0x4e5539['baseRev']!==_0x93f3ed-0x1||_0x4e5539['revision']!==_0x93f3ed)throw Y('Stored\x20changeset\x20history\x20is\x20not\x20contiguous');_0x93f3ed+=0x1;}if(_0x93f3ed-0x1!==_0x2362cd)throw Y('Stored\x20changeset\x20history\x20is\x20incomplete');return _0xaf9561;}async['_getHistoryToLatest'](_0x7d4102,_0x14bdd7,_0x2e4565,_0x2c9096){let _0x766ece=await this['_database'](()=>this['_options']['dbAdapter']['getChangesets'](_0x7d4102,_0x14bdd7,{'from':_0x2c9096}));if(_0x766ece===null)throw Y('Unit\x20is\x20unavailable\x20while\x20reading\x20changeset\x20history');let _0x5aaae4=_0x2c9096+0x1;for(let _0x36f0f5 of _0x766ece){if(_0x36f0f5['unitID']!==_0x14bdd7||_0x36f0f5['type']!==_0x2e4565||_0x36f0f5['baseRev']!==_0x5aaae4-0x1||_0x36f0f5['revision']!==_0x5aaae4)throw Y('Stored\x20changeset\x20history\x20is\x20not\x20contiguous');_0x5aaae4+=0x1;}return _0x766ece;}['_createCandidate'](_0x23c490,_0x4f3682,_0x3861ca){let _0x3725c8=this['_options']['transformer']['parseClient'](_0x23c490);return{...this['_options']['transformer']['transform'](_0x3725c8,_0x4f3682),'unitID':_0x23c490['unitID'],'type':_0x23c490['type'],'baseRev':_0x3861ca,'revision':_0x3861ca+0x1,'sid':_0x23c490['sid'],'reqId':_0x23c490['reqId']};}async['_snapshotBestEffort'](_0x10035e,_0x4451f1,_0x2fa727){let _0x399d3e=this['_options']['snapshotPolicy'];if(!_0x399d3e)return;let _0x259027;try{await this['_measure']('snapshot',async()=>{let _0xc798a=await this['_database'](()=>this['_options']['dbAdapter']['getSnapshotInfo'](_0x10035e,_0x2fa727['unitID']));if(!_0xc798a||_0xc798a['unitID']!==_0x2fa727['unitID']||_0xc798a['type']!==_0x2fa727['type']||!Number['isSafeInteger'](_0xc798a['rev'])||_0xc798a['rev']<0x1)throw Y('Database\x20returned\x20invalid\x20latest\x20snapshot\x20info');if(_0xc798a['rev']>=_0x2fa727['revision'])return;let _0x556b56=_0x2fa727['revision']-_0xc798a['rev'];if(!q(_0x2fa727)&&!_0x399d3e['shouldCreate']({'unitID':_0x2fa727['unitID'],'type':_0x2fa727['type'],'revision':_0x2fa727['revision'],'changesetBytes':kn(_0x2fa727),'revisionsSinceLastSnapshot':_0x556b56}))return;let _0x3e5caa=_0x4451f1??(_0x259027=await this['_options']['runtime']['ensureUnit'](_0x10035e,_0x2fa727['unitID'],_0x2fa727['type'])),_0x47f201=await this['_options']['runtime']['createSnapshot'](_0x3e5caa);await this['_database'](()=>this['_options']['dbAdapter']['saveSnapshot'](_0x10035e,_0x47f201));});}catch(_0x4cf1dc){_0x4cf1dc instanceof C&&_0x4cf1dc['code']==='UNIT_NOT_FOUND'&&this['_options']['runtime']['disposeUnit'](_0x2fa727['unitID']),this['_options']['metrics']['increment']('collaboration.snapshot.failure'),this['_options']['logger']['warn']('Best-effort\x20snapshot\x20failed',{'unitID':_0x2fa727['unitID'],'revision':_0x2fa727['revision'],'error':An(_0x4cf1dc)});}finally{_0x259027&&this['_options']['runtime']['releaseUnit'](_0x259027);}}async['_ensureRestoreSnapshot'](_0x5eb427,_0x4372a7,_0x2625a3){let _0x107899;try{return await this['_measure']('restoreSnapshot',async()=>{if((await this['_getValidatedSnapshot'](_0x5eb427,_0x2625a3))['rev']===_0x2625a3['revision'])return!0x1;let _0x17d6d3=_0x4372a7??(_0x107899=await this['_options']['runtime']['ensureUnit'](_0x5eb427,_0x2625a3['unitID'],_0x2625a3['type']));if(_0x17d6d3['revision']!==_0x2625a3['revision'])throw Y('Unit\x20Runtime\x20is\x20not\x20at\x20the\x20committed\x20restore\x20revision');let _0x5926d3=await this['_options']['runtime']['createSnapshot'](_0x17d6d3);if(_0x5926d3['snapshot']['unitID']!==_0x2625a3['unitID']||_0x5926d3['snapshot']['type']!==_0x2625a3['type']||_0x5926d3['snapshot']['rev']!==_0x2625a3['revision'])throw Y('Unit\x20Runtime\x20returned\x20an\x20invalid\x20restore\x20snapshot');try{await this['_database'](()=>this['_options']['dbAdapter']['saveSnapshot'](_0x5eb427,_0x5926d3));}catch(_0x402e55){if((await this['_getValidatedSnapshot'](_0x5eb427,_0x2625a3))['rev']!==_0x2625a3['revision'])throw _0x402e55;}return!0x0;});}catch(_0x2b1bae){throw this['_options']['metrics']['increment']('collaboration.snapshot.failure',{'reason':'restore-required'}),this['_options']['logger']['warn']('Required\x20restore\x20snapshot\x20failed',{'unitID':_0x2625a3['unitID'],'revision':_0x2625a3['revision'],'error':An(_0x2b1bae)}),_0x2b1bae;}finally{_0x107899&&this['_options']['runtime']['releaseUnit'](_0x107899);}}async['_getValidatedSnapshot'](_0x41f37d,_0x49e252){let _0x1d781e=await this['_database'](()=>this['_options']['dbAdapter']['getSnapshot'](_0x41f37d,_0x49e252['unitID'],{'revision':_0x49e252['revision']}));if(!_0x1d781e||_0x1d781e['unitID']!==_0x49e252['unitID']||_0x1d781e['type']!==_0x49e252['type']||!Number['isSafeInteger'](_0x1d781e['rev'])||_0x1d781e['rev']<0x1||_0x1d781e['rev']>_0x49e252['revision'])throw Y('Database\x20returned\x20an\x20invalid\x20nearest\x20snapshot');return _0x1d781e;}async['_database'](_0x290ae5){try{return await _0x290ae5();}catch(_0x29c113){throw _0x29c113 instanceof C?_0x29c113:new C('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x29c113});}}async['_measure'](_0xe06c80,_0x45e508){let _0x12595a=performance['now']();try{return await _0x45e508();}finally{this['_options']['metrics']['observe']('collaboration.submit.duration',performance['now']()-_0x12595a,{'stage':_0xe06c80});}}};function Tn(_0xad50e){if(!_0xad50e['unitID'])throw J('unitID\x20is\x20required');if(!En['has'](_0xad50e['type']))throw J('Unsupported\x20Unit\x20type');if(!Number['isSafeInteger'](_0xad50e['baseRev'])||_0xad50e['baseRev']<0x1)throw J('baseRev\x20must\x20be\x20a\x20positive\x20safe\x20integer');if(!_0xad50e['sid'])throw J('sid\x20is\x20required');if(!Number['isSafeInteger'](_0xad50e['reqId'])||_0xad50e['reqId']<0x1)throw J('reqId\x20must\x20be\x20a\x20positive\x20safe\x20integer');if(!Array['isArray'](_0xad50e['mutations']))throw J('changeset\x20mutations\x20must\x20be\x20an\x20array');}var En=new Set([c['UniverType']['UNIVER_SHEET'],c['UniverType']['UNIVER_DOC'],c['UniverType']['UNIVER_SLIDE'],c['UniverType']['UNIVER_BOARD'],c['UniverType']['UNIVER_BASE']]);function Dn(_0x28ef52,_0x3019d8,_0x10e3c6=!0x1){if(_0x28ef52['unitID']!==_0x3019d8['unitID']||_0x28ef52['type']!==_0x3019d8['type']||_0x28ef52['sid']!==_0x3019d8['sid']||_0x28ef52['reqId']!==_0x3019d8['reqId']||!Number['isSafeInteger'](_0x28ef52['baseRev'])||_0x28ef52['baseRev']<0x1||!Number['isSafeInteger'](_0x28ef52['revision'])||_0x28ef52['revision']!==_0x28ef52['baseRev']+0x1||_0x10e3c6&&(_0x28ef52['baseRev']!==_0x3019d8['baseRev']||_0x28ef52['revision']!==_0x3019d8['revision']||_0x28ef52['userID']!==_0x3019d8['userID']||_0x28ef52['memberID']!==_0x3019d8['memberID']))throw Y('Database\x20returned\x20an\x20invalid\x20committed\x20changeset');}function On(_0x14449f,_0x1fd519){return _0x14449f['find'](_0x472dd2=>_0x472dd2['sid']===_0x1fd519['sid']&&_0x472dd2['reqId']===_0x1fd519['reqId']);}function kn(_0x5834a5){try{return new TextEncoder()['encode'](JSON['stringify'](_0x5834a5))['byteLength'];}catch{return _0x5834a5['mutationSize']??0x0;}}function q(_0x25e413){return _0x25e413['mutations']['some'](_0x357bf4=>_0x357bf4['id']==='univer.mutation.revert-version');}function J(_0x3f68b0){return new C('INVALID_REQUEST',_0x3f68b0);}function Y(_0x167ced){return new C('ADAPTER_FAILURE',_0x167ced,{'retryable':!0x0});}function An(_0xfaa079){return _0xfaa079 instanceof Error?_0xfaa079['message']:String(_0xfaa079);}var jn=class{['_queues']=new Map();async['runExclusive'](_0x4060d5,_0x447c96){let _0x54f913=this['_queues']['get'](_0x4060d5)??{'tail':Promise['resolve'](),'pending':0x0};_0x54f913['pending']+=0x1,this['_queues']['set'](_0x4060d5,_0x54f913);let _0x2403de=_0x54f913['tail'],_0xc15fc0;_0x54f913['tail']=new Promise(_0x3f9b54=>{_0xc15fc0=_0x3f9b54;}),await _0x2403de;try{return await _0x447c96();}finally{_0xc15fc0(),--_0x54f913['pending'],_0x54f913['pending']===0x0&&this['_queues']['get'](_0x4060d5)===_0x54f913&&this['_queues']['delete'](_0x4060d5);}}['runExclusiveMany'](_0x1f7adb,_0x22da21){let _0x5287ba=[...new Set(_0x1f7adb)]['sort'](),_0xd06ac6=_0x26a8aa=>{let _0x55ba0f=_0x5287ba[_0x26a8aa];return _0x55ba0f===void 0x0?_0x22da21():this['runExclusive'](_0x55ba0f,()=>_0xd06ac6(_0x26a8aa+0x1));};return _0xd06ac6(0x0);}},Mn=class{['_onListenerError'];['_listeners']=new Map();constructor(_0x165319){this['_onListenerError']=_0x165319;}['on'](_0x3e8c35,_0x23adda){let _0x143dd1=this['_listeners']['get'](_0x3e8c35)??[],_0x173dba=_0x23adda;_0x143dd1['push'](_0x173dba),this['_listeners']['set'](_0x3e8c35,_0x143dd1);let _0x5213dc=!0x1;return{'dispose':()=>{if(_0x5213dc)return;_0x5213dc=!0x0;let _0x2c2fe8=_0x143dd1['indexOf'](_0x173dba);_0x2c2fe8>=0x0&&_0x143dd1['splice'](_0x2c2fe8,0x1);}};}async['emit'](_0x509b06,_0x1c7067){let _0x148553=[...this['_listeners']['get'](_0x509b06)??[]];for(let _0x4e46e9 of _0x148553)try{await _0x4e46e9(_0x1c7067);}catch(_0x67fd10){try{this['_onListenerError'](_0x67fd10);}catch{}}}['clear'](){this['_listeners']['clear']();}},Nn=class{['_owner'];['_state']='running';['_activeCalls']=0x0;['_drainPromise'];['_resolveDrain'];['_disposePromise'];constructor(_0x267fb2){this['_owner']=_0x267fb2;}get['state'](){return this['_state'];}['run'](_0x5951fc){return this['_state']==='running'?(this['_activeCalls']+=0x1,Promise['resolve']()['then'](_0x5951fc)['finally'](()=>{--this['_activeCalls'],this['_activeCalls']===0x0&&(this['_resolveDrain']?.(),this['_resolveDrain']=void 0x0,this['_drainPromise']=void 0x0);})):Promise['reject'](new C('INTERNAL_ERROR',this['_owner']+'\x20is\x20'+this['_state'],{'retryable':!0x0}));}['dispose'](_0x2f496d){return this['_disposePromise']?this['_disposePromise']:(this['_state']='disposing',this['_disposePromise']=this['_finishDispose'](_0x2f496d),this['_disposePromise']);}async['_finishDispose'](_0x24e2f4){this['_activeCalls']>0x0&&(this['_drainPromise']=new Promise(_0x180ccf=>{this['_resolveDrain']=_0x180ccf;}),await this['_drainPromise']);try{await _0x24e2f4();}finally{this['_state']='disposed';}}},Pn=new Set([c['UniverType']['UNIVER_SHEET'],c['UniverType']['UNIVER_DOC'],c['UniverType']['UNIVER_SLIDE'],c['UniverType']['UNIVER_BOARD'],c['UniverType']['UNIVER_BASE']]),Fn=0x64,In=class{['_dbAdapter'];['_middleware']=new ze();['_lifecycle']=new Nn('Collaboration\x20Service');['_logger'];['_metrics'];['_events'];['_runtime'];['_coordinator'];['_submitEngine'];constructor(_0xa773ae){if(!_0xa773ae?.['dbAdapter'])throw TypeError('UniverCollabService\x20requires\x20a\x20dbAdapter');this['_dbAdapter']=_0xa773ae['dbAdapter'],this['_logger']=He(_0xa773ae['logger']),this['_metrics']=Ue(_0xa773ae['metrics']),this['_events']=new Mn(_0x407ec0=>{this['_logger']['error']('Collaboration\x20Service\x20event\x20listener\x20failed',{'error':Wn(_0x407ec0)});});let _0x1d7027=_0xa773ae['submitChangeset']?.['maxRevisionRetries']??0x3;if(!Number['isSafeInteger'](_0x1d7027)||_0x1d7027<0x0)throw TypeError('submitChangeset.maxRevisionRetries\x20must\x20be\x20a\x20non-negative\x20safe\x20integer');this['_runtime']=new K({'reader':this['_dbAdapter'],..._0xa773ae['runtime']?.['maxLoadedUnits']===void 0x0?{}:{'maxLoadedUnits':_0xa773ae['runtime']['maxLoadedUnits']},..._0xa773ae['runtime']?.['idleTimeoutMs']===void 0x0?{}:{'idleTimeoutMs':_0xa773ae['runtime']['idleTimeoutMs']}}),this['_coordinator']=new jn(),this['_submitEngine']=new wn({'dbAdapter':this['_dbAdapter'],'middleware':this['_middleware'],'runtime':this['_runtime'],'transformer':this['_runtime']['changesetTransformer'],'coordinator':this['_coordinator'],..._0xa773ae['snapshotPolicy']===!0x1?{}:{'snapshotPolicy':_0xa773ae['snapshotPolicy']??Ie},'enableUnitPermissionAnalysis':_0xa773ae['enableUnitPermissionAnalysis']??!0x1,'maxRevisionRetries':_0x1d7027,'logger':this['_logger'],'metrics':this['_metrics'],'onCommitted':(_0x40cf34,_0x5cd719,_0x3f6ea8,_0x1781ff)=>this['_events']['emit']('changesetCommitted',{'userID':_0x40cf34['userID'],'memberID':_0x40cf34['memberID'],'customData':_0x40cf34['customData'],'request':_0x5cd719,'changeset':_0x3f6ea8,'requiredUnitPermissions':_0x1781ff,'committedAt':Date['now']()})});}get['dbAdapter'](){return this['_dbAdapter'];}['use'](_0x3cb7d6,_0x3532e7){return this['_assertRunning'](),this['_middleware']['use'](_0x3cb7d6,_0x3532e7);}['on'](_0x4b6d45,_0x3701c8){return this['_assertRunning'](),this['_events']['on'](_0x4b6d45,_0x3701c8);}['getUnitLoadData'](_0x3931ce,_0x12b584){return this['_call']('getUnitLoadData',async()=>{let _0x57036d=w(_0x12b584),_0x17fccd=We(_0x3931ce),_0x15b385={..._0x57036d,'request':_0x17fccd},_0x2eb06a;return await this['_middleware']['run']('readUnitData',_0x15b385,async()=>{_0x2eb06a=await this['_getUnitLoadData'](_0x15b385,_0x3931ce);}),_0x2eb06a;});}['getUnitLoadDataWithBlocks'](_0x5ce0aa,_0x256567){return this['_call']('getUnitLoadDataWithBlocks',async()=>{let _0x15de31=w(_0x256567),_0xc1e7d4=We(_0x5ce0aa),_0x461ade={..._0x15de31,'request':_0xc1e7d4},_0xbbf797;return await this['_middleware']['run']('readUnitData',_0x461ade,async()=>{let _0x3a29c1=await this['_getUnitLoadData'](_0x461ade,_0x5ce0aa),_0x286b27=await this['_getSnapshotSheetBlocks'](_0x461ade,_0x3a29c1['snapshot']);_0xbbf797={..._0x3a29c1,'sheetBlocks':_0x286b27};}),_0xbbf797;});}['getChangesets'](_0x39a44f,_0x121cf1){return this['_call']('getChangesets',async()=>{let _0x39edcc=w(_0x121cf1),_0x27098b=Ge(_0x39a44f),_0x362c8d={..._0x39edcc,'request':_0x27098b},_0x6b848e;return await this['_middleware']['run']('readUnitData',_0x362c8d,async()=>{X(_0x39a44f['unitID'],_0x39a44f['type']),Vn('from',_0x39a44f['from']),Vn('to',_0x39a44f['to']);let _0x40cedc=await this['_requireUnit'](_0x362c8d,_0x39a44f['unitID'],_0x39a44f['type']),_0x58d950=_0x39a44f['to']===0x0?void 0x0:Hn(_0x39a44f['to'],_0x40cedc);if(_0x39a44f['from']>(_0x58d950??_0x40cedc['headRevision']))throw Z('Changeset\x20range\x20starts\x20after\x20its\x20target');let _0x45d1dc=await this['_database'](()=>this['_dbAdapter']['getChangesets'](_0x362c8d,_0x39a44f['unitID'],{'from':_0x39a44f['from'],..._0x58d950===void 0x0?{}:{'to':_0x58d950}}));if(_0x45d1dc===null)throw new C('UNIT_NOT_FOUND','Unit\x20'+_0x39a44f['unitID']+'\x20does\x20not\x20exist');Un(_0x45d1dc,_0x39a44f['unitID'],_0x39a44f['type'],Math['max'](_0x39a44f['from']+0x1,0x2),_0x58d950),_0x6b848e={'changesets':_0x45d1dc};}),_0x6b848e;});}['getSheetBlock'](_0x3759aa,_0x2dd68f){return this['_call']('getSheetBlock',async()=>{let _0x268612=w(_0x2dd68f),_0x5a6e36=Ke(_0x3759aa),_0x5f0001={..._0x268612,'request':_0x5a6e36},_0x14036f;return await this['_middleware']['run']('readUnitData',_0x5f0001,async()=>{if(X(_0x3759aa['unitID'],_0x3759aa['type']),!_0x3759aa['blockID'])throw Z('blockID\x20is\x20required');await this['_requireUnit'](_0x5f0001,_0x3759aa['unitID'],_0x3759aa['type']),_0x14036f={'block':await this['_database'](()=>this['_dbAdapter']['getSheetBlock'](_0x5f0001,_0x3759aa['unitID'],_0x3759aa['blockID']))};}),_0x14036f;});}['createUnitFromSnapshot'](_0x31a548,_0x4ec917){return this['_call']('createUnitFromSnapshot',()=>this['_createUnit'](_0x31a548,w(_0x4ec917)));}['createUnitFromData'](_0x4e5458,_0x2dc248){return this['_call']('createUnitFromData',async()=>{if(!_0x4e5458||!Pn['has'](_0x4e5458['type']))throw Z('Unsupported\x20unit\x20type');if(!_0x4e5458['data']?.['id'])throw Z('data.id\x20is\x20required');if(_0x4e5458['data']['rev']!==0x1)throw Z('Initial\x20Unit\x20data\x20revision\x20must\x20be\x201');let _0x70b3f7=w(_0x2dc248),_0x450bf5=await Ze(_0x4e5458);return this['_createUnit'](_0x450bf5,_0x70b3f7);});}['deleteUnits'](_0x5a9435,_0xa233f6){return this['_call']('deleteUnits',async()=>{let _0x4b5f6a=w(_0xa233f6),_0x5333b8=Ln(_0x5a9435?.['unitIDs']);if(_0x5a9435['hardDelete']!==void 0x0&&typeof _0x5a9435['hardDelete']!='boolean')throw Z('hardDelete\x20must\x20be\x20a\x20boolean');let _0x1db2b7=Je({'unitIDs':_0x5333b8,'hardDelete':_0x5a9435['hardDelete']??!0x1}),_0x476ec6={..._0x4b5f6a,'request':_0x1db2b7},_0x116f6a;return await this['_coordinator']['runExclusiveMany'](_0x5333b8,()=>this['_middleware']['run']('deleteUnits',_0x476ec6,async()=>{let _0x39b7c4=await this['_database'](()=>this['_dbAdapter']['deleteUnits'](_0x476ec6,{'unitIDs':_0x5333b8,'hardDelete':_0x1db2b7['hardDelete']}));for(let _0x267135 of _0x5333b8)this['_runtime']['disposeUnit'](_0x267135);Rn(_0x39b7c4,_0x5333b8,_0x1db2b7['hardDelete']),_0x116f6a=_0x39b7c4,await this['_events']['emit']('unitsDeleted',{'userID':_0x4b5f6a['userID'],'customData':_0x4b5f6a['customData'],'request':_0x1db2b7,'result':_0x39b7c4,'deletedAt':Date['now']()});})),_0x116f6a;});}['recoverUnits'](_0x576c6e,_0x46e72f){return this['_call']('recoverUnits',async()=>{let _0x24c3f6=w(_0x46e72f),_0x39dfd9=Ln(_0x576c6e?.['unitIDs']),_0xf4b4d3=Ye({'unitIDs':_0x39dfd9}),_0x1e50dd={..._0x24c3f6,'request':_0xf4b4d3},_0x46436f;return await this['_coordinator']['runExclusiveMany'](_0x39dfd9,()=>this['_middleware']['run']('recoverUnits',_0x1e50dd,async()=>{let _0x5de5dd=await this['_database'](()=>this['_dbAdapter']['recoverUnits'](_0x1e50dd,{'unitIDs':_0x39dfd9}));zn(_0x5de5dd,_0x39dfd9),_0x46436f=_0x5de5dd,await this['_events']['emit']('unitsRecovered',{'userID':_0x24c3f6['userID'],'customData':_0x24c3f6['customData'],'request':_0xf4b4d3,'result':_0x5de5dd,'recoveredAt':Date['now']()});})),_0x46436f;});}async['submitChangeset'](_0x517194,_0x36463f){try{return await this['_lifecycle']['run'](async()=>{let _0x561232=Le(_0x36463f),_0x345dc8=Xe(_0x517194,_0x561232);_0x345dc8['changeset']['createTime']??=Math['floor'](Date['now']()/0x3e8);let _0x4d7550={..._0x561232,'request':_0x345dc8},_0x321539;return await this['_middleware']['run']('submitChangeset',_0x4d7550,async()=>{_0x321539=await this['_submitEngine']['submit'](_0x4d7550,_0x345dc8);}),_0x321539;});}catch(_0x8c80b1){let _0x244a55=this['_normalizeError']('submitChangeset',_0x8c80b1);return{'status':_0x244a55['retryable']?'retry':'rejected','error':_0x244a55};}}['dispose'](){return this['_lifecycle']['dispose'](async()=>{this['_middleware']['clear'](),this['_events']['clear'](),await this['_runtime']['dispose']();});}async['_getUnitLoadData'](_0x2f231a,_0x36ac1c){X(_0x36ac1c['unitID'],_0x36ac1c['type']),Vn('revision',_0x36ac1c['revision']);let _0x27a028=await this['_requireUnit'](_0x2f231a,_0x36ac1c['unitID'],_0x36ac1c['type']),_0x3c1ecf=Hn(_0x36ac1c['revision'],_0x27a028),_0x2caef8=await this['_database'](()=>this['_dbAdapter']['getSnapshot'](_0x2f231a,_0x36ac1c['unitID'],{'revision':_0x3c1ecf}));if(!_0x2caef8)throw new C('ADAPTER_FAILURE','Database\x20returned\x20a\x20unit\x20without\x20a\x20recoverable\x20snapshot',{'retryable':!0x0});if(_0x2caef8['unitID']!==_0x36ac1c['unitID']||_0x2caef8['type']!==_0x36ac1c['type']||!Number['isSafeInteger'](_0x2caef8['rev'])||_0x2caef8['rev']<0x1||_0x2caef8['rev']>_0x3c1ecf)throw new C('ADAPTER_FAILURE','Database\x20returned\x20an\x20invalid\x20snapshot',{'retryable':!0x0});let _0x34b48b=await this['_database'](()=>this['_dbAdapter']['getChangesets'](_0x2f231a,_0x36ac1c['unitID'],{'from':_0x2caef8['rev'],'to':_0x3c1ecf}));if(_0x34b48b===null)throw new C('UNIT_NOT_FOUND','Unit\x20'+_0x36ac1c['unitID']+'\x20does\x20not\x20exist');return Un(_0x34b48b,_0x36ac1c['unitID'],_0x36ac1c['type'],_0x2caef8['rev']+0x1,_0x3c1ecf),{'snapshot':_0x2caef8,'changesets':_0x34b48b,'targetRevision':_0x3c1ecf};}async['_getSnapshotSheetBlocks'](_0x16a3b3,_0x436836){let _0x10a844=et(_0x436836);return Promise['all'](_0x10a844['map'](async _0x5db453=>{let _0x1699a5=await this['_database'](()=>this['_dbAdapter']['getSheetBlock'](_0x16a3b3,_0x436836['unitID'],_0x5db453));if(!_0x1699a5||_0x1699a5['id']!==_0x5db453)throw Q('Database\x20returned\x20an\x20invalid\x20referenced\x20Sheet\x20block\x20'+_0x5db453);return _0x1699a5;}));}async['_createUnit'](_0x441d98,_0x4a02fc){let _0x295ad1=qe(_0x441d98),_0xffff65={..._0x4a02fc,'request':_0x295ad1},_0x5c3463,{snapshot:_0x4403b0}=_0x441d98;return await this['_coordinator']['runExclusive'](_0x4403b0['unitID'],()=>this['_middleware']['run']('createUnit',_0xffff65,async()=>{if(X(_0x4403b0['unitID'],_0x4403b0['type']),_0x4403b0['rev']!==0x1)throw Z('Initial\x20snapshot\x20revision\x20must\x20be\x201');let _0x1c3955=await this['_database'](()=>this['_dbAdapter']['createUnit'](_0xffff65,{'record':{'unitID':_0x4403b0['unitID'],'type':_0x4403b0['type'],'headRevision':0x1,'creatorID':_0x4a02fc['userID'],'createdAt':Date['now']()},'snapshot':_0x4403b0,..._0x441d98['sheetBlocks']===void 0x0?{}:{'sheetBlocks':_0x441d98['sheetBlocks']}}));if(_0x1c3955['record']['unitID']!==_0x4403b0['unitID']||_0x1c3955['record']['type']!==_0x4403b0['type']||!Number['isSafeInteger'](_0x1c3955['record']['headRevision'])||_0x1c3955['record']['headRevision']<0x1)throw new C('ADAPTER_FAILURE','Database\x20returned\x20an\x20invalid\x20created\x20unit\x20record',{'retryable':!0x0});_0x5c3463={'status':_0x1c3955['status'],'unitID':_0x1c3955['record']['unitID'],'headRevision':_0x1c3955['record']['headRevision']},_0x1c3955['status']==='created'&&await this['_events']['emit']('unitCreated',{'userID':_0x4a02fc['userID'],'customData':_0x4a02fc['customData'],'request':_0x295ad1,'record':_0x1c3955['record'],'createdAt':Date['now']()});})),_0x5c3463;}async['_requireUnit'](_0x1b5802,_0x39b2b0,_0x467114){let _0x49f8c6=await this['_database'](()=>this['_dbAdapter']['getUnit'](_0x1b5802,_0x39b2b0));if(!_0x49f8c6)throw new C('UNIT_NOT_FOUND','Unit\x20'+_0x39b2b0+'\x20does\x20not\x20exist');if(_0x49f8c6['unitID']!==_0x39b2b0)throw new C('ADAPTER_FAILURE','Database\x20returned\x20Unit\x20metadata\x20for\x20a\x20different\x20identity',{'retryable':!0x0});if(_0x49f8c6['type']!==_0x467114)throw Z('Unit\x20type\x20does\x20not\x20match\x20the\x20stored\x20unit');if(!Number['isSafeInteger'](_0x49f8c6['headRevision'])||_0x49f8c6['headRevision']<0x1)throw new C('ADAPTER_FAILURE','Database\x20returned\x20an\x20invalid\x20unit\x20head\x20revision',{'retryable':!0x0});return _0x49f8c6;}async['_database'](_0x38ceda){try{return await _0x38ceda();}catch(_0x5424c9){throw _0x5424c9 instanceof C?_0x5424c9:new C('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x5424c9});}}async['_call'](_0x411f19,_0x3ee8f1){try{return this['_metrics']['increment']('collaboration.service.call',{'operation':_0x411f19}),await this['_lifecycle']['run'](_0x3ee8f1);}catch(_0x21341d){throw this['_normalizeError'](_0x411f19,_0x21341d);}}['_normalizeError'](_0x1e15c8,_0x48f206){return _0x48f206 instanceof C?_0x48f206:(this['_logger']['error']('Collaboration\x20Service\x20operation\x20failed',{'operation':_0x1e15c8,'error':Wn(_0x48f206)}),new C('INTERNAL_ERROR','Collaboration\x20Service\x20failed',{'retryable':!0x0,'cause':_0x48f206}));}['_assertRunning'](){if(this['_lifecycle']['state']!=='running')throw new C('INTERNAL_ERROR','Collaboration\x20Service\x20is\x20'+this['_lifecycle']['state'],{'retryable':!0x0});}};function X(_0x5b3489,_0x175325){if(!_0x5b3489)throw Z('unitID\x20is\x20required');if(!Pn['has'](_0x175325))throw Z('Unsupported\x20unit\x20type');}function Ln(_0x4588cd){if(!Array['isArray'](_0x4588cd)||_0x4588cd['length']===0x0)throw Z('unitIDs\x20must\x20be\x20a\x20non-empty\x20array');if(_0x4588cd['length']>0x64)throw Z('unitIDs\x20cannot\x20contain\x20more\x20than\x20100\x20values');let _0x502cca=[],_0x4c385b=new Set();for(let _0x462ddb of _0x4588cd){if(typeof _0x462ddb!='string'||_0x462ddb['trim']()['length']===0x0)throw Z('unitIDs\x20cannot\x20contain\x20empty\x20values');_0x4c385b['has'](_0x462ddb)||(_0x4c385b['add'](_0x462ddb),_0x502cca['push'](_0x462ddb));}return _0x502cca;}function Rn(_0x3e5cc3,_0x2494c8,_0x547b24){let _0xd3ad0c=_0x547b24?new Set(['hard-deleted','already-hard-deleted']):new Set(['soft-deleted','already-soft-deleted']);Bn(_0x3e5cc3?.['units'],_0x2494c8,_0xd3ad0c,'delete');}function zn(_0x361b1f,_0xcf8f34){let _0x555a64=new Set(['recovered','already-active']);Bn(_0x361b1f?.['units'],_0xcf8f34,_0x555a64,'recover');}function Bn(_0x540970,_0x1a6e8e,_0x45e69c,_0x405310){if(!Array['isArray'](_0x540970)||_0x540970['length']!==_0x1a6e8e['length'])throw Q('Database\x20returned\x20incomplete\x20'+_0x405310+'\x20Unit\x20results');for(let [_0x128baf,_0x45865b]of _0x540970['entries']())if(!_0x45865b||_0x45865b['unitID']!==_0x1a6e8e[_0x128baf]||!_0x45e69c['has'](_0x45865b['status']))throw Q('Database\x20returned\x20invalid\x20'+_0x405310+'\x20Unit\x20results');}function Vn(_0x3b92e5,_0x14e6f1){if(!Number['isSafeInteger'](_0x14e6f1)||_0x14e6f1<0x0)throw Z(_0x3b92e5+'\x20must\x20be\x20a\x20non-negative\x20safe\x20integer');}function Hn(_0x2ed564,_0x4b3ef5){let _0x506011=_0x2ed564===0x0?_0x4b3ef5['headRevision']:_0x2ed564;if(_0x506011<0x1||_0x506011>_0x4b3ef5['headRevision'])throw Z('Requested\x20revision\x20is\x20outside\x20the\x20stored\x20unit\x20history');return _0x506011;}function Un(_0x26cfe6,_0x4cf83f,_0x263c0d,_0x1b8b97,_0x654742){let _0x42e3e8=_0x1b8b97;for(let _0x35cc00 of _0x26cfe6){if(_0x35cc00['unitID']!==_0x4cf83f||_0x35cc00['type']!==_0x263c0d||_0x35cc00['baseRev']!==_0x42e3e8-0x1||_0x35cc00['revision']!==_0x42e3e8)throw new C('ADAPTER_FAILURE','Database\x20returned\x20a\x20non-contiguous\x20changeset\x20history',{'retryable':!0x0});_0x42e3e8+=0x1;}if(_0x654742!==void 0x0&&_0x42e3e8-0x1!==_0x654742)throw new C('ADAPTER_FAILURE','Database\x20returned\x20an\x20incomplete\x20changeset\x20history',{'retryable':!0x0});}function Z(_0x5ee058){return new C('INVALID_REQUEST',_0x5ee058);}function Q(_0x53d365){return new C('ADAPTER_FAILURE',_0x53d365,{'retryable':!0x0});}function Wn(_0x35789c){return _0x35789c instanceof Error?_0x35789c['message']:String(_0x35789c);}var Gn=class{['_reader']=new Kn();['_runtime']=new K({'reader':this['_reader']});['_coordinator']=new jn();['_lifecycle']=new Nn('Unit\x20Snapshot\x20Materializer');['materializeSnapshot'](_0x2c2bd0){return this['_lifecycle']['run'](async()=>{qn(_0x2c2bd0);let {snapshot:_0x1dd616,targetRevision:_0xb3cb2d}=_0x2c2bd0;return this['_coordinator']['runExclusive'](_0x1dd616['unitID'],async()=>{this['_runtime']['disposeUnit'](_0x1dd616['unitID']),this['_reader']['bind'](_0x2c2bd0);let _0x11ee21={'userID':'unit-snapshot-materializer','customData':Object['create'](null),'request':Object['create'](null)},_0x757295;try{_0x757295=await this['_runtime']['ensureUnit'](_0x11ee21,_0x1dd616['unitID'],_0x1dd616['type']);let _0x1b29aa=await this['_runtime']['createSnapshot'](_0x757295);if(_0x1b29aa['snapshot']['unitID']!==_0x1dd616['unitID']||_0x1b29aa['snapshot']['type']!==_0x1dd616['type']||_0x1b29aa['snapshot']['rev']!==_0xb3cb2d)throw new C('INTERNAL_ERROR','Unit\x20Runtime\x20materialized\x20an\x20unexpected\x20snapshot\x20revision',{'retryable':!0x0});return{'snapshot':_0x1b29aa['snapshot'],'sheetBlocks':[..._0x1b29aa['sheetBlocks']??[]]};}finally{_0x757295&&this['_runtime']['releaseUnit'](_0x757295),this['_runtime']['disposeUnit'](_0x1dd616['unitID']),this['_reader']['unbind'](_0x1dd616['unitID']);}});});}['dispose'](){return this['_lifecycle']['dispose'](()=>this['_runtime']['dispose']());}},Kn=class{['_bound']=new Map();['bind'](_0x2da27e){let _0x3130e9;try{_0x3130e9={'snapshot':structuredClone(_0x2da27e['snapshot']),'sheetBlocks':structuredClone(_0x2da27e['sheetBlocks']),'changesets':structuredClone(_0x2da27e['changesets']),'targetRevision':_0x2da27e['targetRevision']};}catch(_0x4975fd){throw new C('INVALID_REQUEST','Materialization\x20input\x20must\x20be\x20structured-cloneable',{'cause':_0x4975fd});}this['_bound']['set'](_0x3130e9['snapshot']['unitID'],{'input':_0x3130e9,'blocks':new Map(_0x3130e9['sheetBlocks']['map'](_0x32ac35=>[_0x32ac35['id'],_0x32ac35]))});}['unbind'](_0x24e535){this['_bound']['delete'](_0x24e535);}async['getUnit'](_0x124efe,_0x4aff34){let _0x47256f=this['_bound']['get'](_0x4aff34);return _0x47256f?{'unitID':_0x4aff34,'type':_0x47256f['input']['snapshot']['type'],'headRevision':_0x47256f['input']['targetRevision']}:null;}async['getSnapshot'](_0x5b7322,_0x3cc754,_0x2d8864){let _0x5644f2=this['_bound']['get'](_0x3cc754),_0x4ed4f5=_0x2d8864?.['revision']??_0x5644f2?.['input']['targetRevision'];return _0x5644f2&&_0x4ed4f5!==void 0x0&&_0x5644f2['input']['snapshot']['rev']<=_0x4ed4f5?_0x5644f2['input']['snapshot']:null;}async['getChangesets'](_0x4e82f5,_0x5e519d,_0x134103){let _0x5bcc63=this['_bound']['get'](_0x5e519d);if(!_0x5bcc63)return null;let _0x18545d=Math['min'](_0x134103['to']??_0x5bcc63['input']['targetRevision'],_0x5bcc63['input']['targetRevision']);return _0x5bcc63['input']['changesets']['filter'](_0x5d7b27=>_0x5d7b27['revision']>_0x134103['from']&&_0x5d7b27['revision']<=_0x18545d);}['getSheetBlock'](_0x3ac9cf,_0x56086e,_0x33851c){return Promise['resolve'](this['_require'](_0x56086e)['blocks']['get'](_0x33851c)??null);}['_require'](_0x56cbd5){let _0x51441b=this['_bound']['get'](_0x56cbd5);if(!_0x51441b)throw new C('INTERNAL_ERROR','Materialization\x20data\x20for\x20Unit\x20'+_0x56cbd5+'\x20is\x20unavailable',{'retryable':!0x0});return _0x51441b;}};function qn(_0x14ab6a){if(!_0x14ab6a||typeof _0x14ab6a!='object'||!_0x14ab6a['snapshot'])throw $('Materialization\x20input\x20requires\x20a\x20snapshot');let {snapshot:_0xb48275,targetRevision:_0x430a7a,changesets:_0x30b157,sheetBlocks:_0x11d128}=_0x14ab6a;if(typeof _0xb48275['unitID']!='string'||_0xb48275['unitID']['length']===0x0||!Number['isSafeInteger'](_0xb48275['rev'])||_0xb48275['rev']<0x1||!Number['isSafeInteger'](_0x430a7a)||_0x430a7a<_0xb48275['rev'])throw $('Materialization\x20revisions\x20are\x20invalid');if(!Array['isArray'](_0x30b157)||!Array['isArray'](_0x11d128))throw $('Materialization\x20changesets\x20and\x20sheetBlocks\x20must\x20be\x20arrays');let _0x2fdc41=_0xb48275['rev']+0x1;for(let _0x291c75 of _0x30b157){if(_0x291c75['unitID']!==_0xb48275['unitID']||_0x291c75['type']!==_0xb48275['type']||_0x291c75['baseRev']!==_0x2fdc41-0x1||_0x291c75['revision']!==_0x2fdc41)throw $('Materialization\x20changesets\x20are\x20not\x20contiguous');_0x2fdc41+=0x1;}if(_0x2fdc41-0x1!==_0x430a7a)throw $('Materialization\x20changesets\x20do\x20not\x20reach\x20targetRevision');let _0x5e4641=new Map();for(let _0x472b50 of _0x11d128){if(!_0x472b50||typeof _0x472b50['id']!='string'||_0x472b50['id']['length']===0x0||_0x5e4641['has'](_0x472b50['id']))throw $('Materialization\x20Sheet\x20blocks\x20are\x20invalid');_0x5e4641['set'](_0x472b50['id'],_0x472b50);}for(let _0x5a3865 of et(_0xb48275))if(!_0x5e4641['has'](_0x5a3865))throw $('Materialization\x20is\x20missing\x20Sheet\x20block\x20'+_0x5a3865);}function $(_0x5130f4){return new C('INVALID_REQUEST',_0x5130f4);}exports['CollabError']=C,exports['MAX_UNIT_LIFECYCLE_BATCH_SIZE']=Fn,exports['UnitSnapshotMaterializer']=Gn,exports['UniverCollabService']=In,exports['UniverUnitRuntime']=K;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function _0x486d(_0x527a6f,_0x3d1b16){_0x527a6f=_0x527a6f-0x161;const _0x161413=_0x1614();let _0x486d7c=_0x161413[_0x527a6f];return _0x486d7c;}function _0x1614(){const _0x5c0003=['UniverCollabService','50325joThwv','2534289ILvpmZ','UniverUnitRuntime','UnitSnapshotMaterializer','CollabError','254745EfwdGN','5962098ylHCWy','2OkxYID','36GmaUoc','7683525LPWfVn','917145HQLCdF','8ASCsQP','4601982GPYKeU','80htHCaM'];_0x1614=function(){return _0x5c0003;};return _0x1614();}const _0x136583=_0x486d;(function(_0x575133,_0x15db07){const _0x34a147=_0x486d,_0x53896b=_0x575133();while(!![]){try{const _0x4bfc90=parseInt(_0x34a147(0x16d))/0x1+-parseInt(_0x34a147(0x16a))/0x2*(-parseInt(_0x34a147(0x164))/0x3)+parseInt(_0x34a147(0x16b))/0x4*(-parseInt(_0x34a147(0x168))/0x5)+-parseInt(_0x34a147(0x169))/0x6+-parseInt(_0x34a147(0x16f))/0x7+parseInt(_0x34a147(0x16e))/0x8*(parseInt(_0x34a147(0x16c))/0x9)+-parseInt(_0x34a147(0x161))/0xa*(-parseInt(_0x34a147(0x163))/0xb);if(_0x4bfc90===_0x15db07)break;else _0x53896b['push'](_0x53896b['shift']());}catch(_0x12e048){_0x53896b['push'](_0x53896b['shift']());}}}(_0x1614,0x84777));import _0x34372c from'./index.cjs';const facadeExport0=_0x34372c[_0x136583(0x167)],facadeExport1=_0x34372c['MAX_UNIT_LIFECYCLE_BATCH_SIZE'],facadeExport2=_0x34372c[_0x136583(0x166)],facadeExport3=_0x34372c[_0x136583(0x162)],facadeExport4=_0x34372c[_0x136583(0x165)];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.3",
|
|
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.3",
|
|
20
|
+
"@univerjs-pro/bases-dashboard": "1.0.3",
|
|
21
|
+
"@univerjs-pro/bases-thread-comment": "1.0.3",
|
|
22
|
+
"@univerjs-pro/boards": "1.0.3",
|
|
23
|
+
"@univerjs-pro/boards-chart": "1.0.3",
|
|
24
|
+
"@univerjs-pro/boards-mind": "1.0.3",
|
|
25
|
+
"@univerjs-pro/boards-table": "1.0.3",
|
|
26
|
+
"@univerjs-pro/boards-thread-comment": "1.0.3",
|
|
27
|
+
"@univerjs-pro/collaboration": "1.0.3",
|
|
28
|
+
"@univerjs-pro/docs-callout": "1.0.3",
|
|
29
|
+
"@univerjs-pro/docs-chart": "1.0.3",
|
|
30
|
+
"@univerjs-pro/docs-code": "1.0.3",
|
|
31
|
+
"@univerjs-pro/docs-latex": "1.0.3",
|
|
32
|
+
"@univerjs-pro/docs-shape": "1.0.3",
|
|
33
|
+
"@univerjs-pro/docs-table": "1.0.3",
|
|
34
|
+
"@univerjs-pro/embed": "1.0.3",
|
|
35
|
+
"@univerjs-pro/engine-chart": "1.0.3",
|
|
36
|
+
"@univerjs-pro/engine-formula-rust": "1.0.3",
|
|
37
|
+
"@univerjs-pro/sheets-chart": "1.0.3",
|
|
38
|
+
"@univerjs-pro/sheets-outline": "1.0.3",
|
|
39
|
+
"@univerjs-pro/sheets-pivot": "1.0.3",
|
|
40
|
+
"@univerjs-pro/sheets-shape": "1.0.3",
|
|
41
|
+
"@univerjs-pro/sheets-sparkline": "1.0.3",
|
|
42
|
+
"@univerjs-pro/slides": "1.0.3",
|
|
43
|
+
"@univerjs-pro/slides-chart": "1.0.3",
|
|
44
|
+
"@univerjs-pro/slides-table": "1.0.3",
|
|
45
|
+
"@univerjs-pro/slides-thread-comment": "1.0.3",
|
|
46
|
+
"@univerjs-pro/thread-comment-resource": "1.0.3",
|
|
47
|
+
"@univerjs/core": "1.0.3",
|
|
48
|
+
"@univerjs/data-validation": "1.0.3",
|
|
49
|
+
"@univerjs/docs": "1.0.3",
|
|
50
|
+
"@univerjs/docs-drawing": "1.0.3",
|
|
51
|
+
"@univerjs/docs-hyper-link": "1.0.3",
|
|
52
|
+
"@univerjs/docs-thread-comment": "1.0.3",
|
|
53
|
+
"@univerjs/drawing": "1.0.3",
|
|
54
|
+
"@univerjs/engine-formula": "1.0.3",
|
|
55
|
+
"@univerjs/protocol": "1.0.3",
|
|
56
|
+
"@univerjs/sheets": "1.0.3",
|
|
57
|
+
"@univerjs/sheets-conditional-formatting": "1.0.3",
|
|
58
|
+
"@univerjs/sheets-drawing": "1.0.3",
|
|
59
|
+
"@univerjs/sheets-filter": "1.0.3",
|
|
60
|
+
"@univerjs/sheets-formula": "1.0.3",
|
|
61
|
+
"@univerjs/sheets-hyper-link": "1.0.3",
|
|
62
|
+
"@univerjs/sheets-note": "1.0.3",
|
|
63
|
+
"@univerjs/sheets-sort": "1.0.3",
|
|
64
|
+
"@univerjs/sheets-table": "1.0.3",
|
|
65
|
+
"@univerjs/sheets-thread-comment": "1.0.3",
|
|
66
|
+
"@univerjs/thread-comment": "1.0.3",
|
|
67
67
|
"rxjs": "^7.8.2"
|
|
68
68
|
}
|
|
69
69
|
}
|