@univerjs-pro/collaboration-service 1.0.3 → 1.0.4

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 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=(_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;
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=(_0x4e5ad1,_0x3fa813,_0x5a070b,_0x57d848)=>{if(_0x3fa813&&typeof _0x3fa813=='object'||typeof _0x3fa813=='function'){for(var _0x1cccdd=r(_0x3fa813),_0xc2524a=0x0,_0x1503c0=_0x1cccdd['length'],_0x36a09e;_0xc2524a<_0x1503c0;_0xc2524a++)_0x36a09e=_0x1cccdd[_0xc2524a],!a['call'](_0x4e5ad1,_0x36a09e)&&_0x36a09e!==_0x5a070b&&t(_0x4e5ad1,_0x36a09e,{'get':(_0x5ab584=>_0x3fa813[_0x5ab584])['bind'](null,_0x36a09e),'enumerable':!(_0x57d848=n(_0x3fa813,_0x36a09e))||_0x57d848['enumerable']});}return _0x4e5ad1;},s=(_0x29523c,_0x1465fe,_0xd1aa3d)=>(_0xd1aa3d=_0x29523c==null?{}:e(i(_0x29523c)),o(_0x1465fe||!_0x29523c||!_0x29523c['__esModule']?t(_0xd1aa3d,'default',{'value':_0x29523c,'enumerable':!0x0}):_0xd1aa3d,_0x29523c));let c=require('@univerjs/protocol'),l=require('@univerjs-pro/collaboration'),u=require('node:v8'),d=require('@univerjs/core'),ee=require('node:timers/promises'),te=require('node:crypto'),ne=require('@univerjs-pro/engine-formula-rust'),f=require('@univerjs/sheets/locale/en-US');f=s(f,0x1);let p=require('@univerjs-pro/bases'),re=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'),ie=require('node:async_hooks'),ae=require('@univerjs/engine-formula'),oe=require('@univerjs-pro/bases-dashboard'),se=require('@univerjs-pro/bases-thread-comment'),ce=require('@univerjs-pro/boards-chart'),le=require('@univerjs-pro/boards-mind'),ue=require('@univerjs-pro/boards-table'),de=require('@univerjs-pro/boards-thread-comment'),fe=require('@univerjs-pro/docs-callout'),pe=require('@univerjs-pro/docs-chart'),me=require('@univerjs-pro/docs-code'),he=require('@univerjs-pro/docs-latex'),ge=require('@univerjs-pro/docs-shape'),_e=require('@univerjs-pro/docs-table'),ve=require('@univerjs-pro/embed'),ye=require('@univerjs-pro/engine-formula'),be=require('@univerjs-pro/sheets-chart'),xe=require('@univerjs-pro/sheets-outline'),Se=require('@univerjs-pro/sheets-pivot'),Ce=require('@univerjs-pro/sheets-pivot-chart'),we=require('@univerjs-pro/sheets-shape'),Te=require('@univerjs-pro/sheets-sparkline'),Ee=require('@univerjs-pro/slides-thread-comment'),De=require('@univerjs-pro/thread-comment-resource'),Oe=require('@univerjs/docs-drawing'),ke=require('@univerjs/docs-hyper-link'),Ae=require('@univerjs/docs-thread-comment'),je=require('@univerjs/drawing'),Me=require('@univerjs/sheets-drawing'),Ne=require('@univerjs/sheets-hyper-link'),Pe=require('@univerjs/sheets-note'),Fe=require('@univerjs/sheets-sort'),Ie=require('@univerjs/sheets-table'),Le=require('@univerjs/sheets-thread-comment'),Re=require('node:os'),ze=require('node:path');require('node:url');let Be=require('node:worker_threads');var C=class extends Error{['code'];['retryable'];['details'];constructor(_0x962f47,_0x1bf044,_0x1a9f15={}){super(_0x1bf044,{'cause':_0x1a9f15['cause']}),this['name']='CollabError',this['code']=_0x962f47,this['retryable']=_0x1a9f15['retryable']??!0x1,_0x1a9f15['details']!==void 0x0&&(this['details']=_0x1a9f15['details']);}},Ve=0x32,He=0x5*0x400*0x400,Ue={'shouldCreate'(_0x476617){return _0x476617['revisionsSinceLastSnapshot']>=Ve||_0x476617['changesetBytes']>=He;}};function w(_0x172774){return Ge(_0x172774),{'userID':_0x172774['userID'],'customData':_0x172774['customData']??Object['create'](null)};}function We(_0x1df7bf){if(Ge(_0x1df7bf),typeof _0x1df7bf['memberID']!='string'||_0x1df7bf['memberID']['length']===0x0)throw T('memberID\x20must\x20be\x20a\x20non-empty\x20string');return{'userID':_0x1df7bf['userID'],'memberID':_0x1df7bf['memberID'],'customData':_0x1df7bf['customData']??Object['create'](null)};}function Ge(_0x5dc56a){if(!_0x5dc56a||typeof _0x5dc56a!='object')throw T('context\x20must\x20be\x20an\x20object');if(typeof _0x5dc56a['userID']!='string'||_0x5dc56a['userID']['length']===0x0)throw T('userID\x20must\x20be\x20a\x20non-empty\x20string');if(_0x5dc56a['customData']!==void 0x0&&(_0x5dc56a['customData']===null||typeof _0x5dc56a['customData']!='object'||Array['isArray'](_0x5dc56a['customData'])))throw T('customData\x20must\x20be\x20an\x20object');}function T(_0x38e005){return new C('INVALID_REQUEST',_0x38e005);}var Ke=class{['_middlewares']=new Map();['use'](_0x424519,_0xb0a4cb){let _0x9f1bde=this['_middlewares']['get'](_0x424519)??[],_0x283fb5=_0xb0a4cb;_0x9f1bde['push'](_0x283fb5),this['_middlewares']['set'](_0x424519,_0x9f1bde);let _0x1c0e9e=!0x1;return{'dispose':()=>{if(_0x1c0e9e)return;_0x1c0e9e=!0x0;let _0x14c7e9=_0x9f1bde['indexOf'](_0x283fb5);_0x14c7e9>=0x0&&_0x9f1bde['splice'](_0x14c7e9,0x1);}};}async['run'](_0x32cc7b,_0x23a08b,_0x850b02){let _0x6e2f05=[...this['_middlewares']['get'](_0x32cc7b)??[]],_0x5f0c35=async _0x41a624=>{let _0x77fb03=_0x6e2f05[_0x41a624];if(!_0x77fb03){await _0x850b02();return;}let _0x4c6b09=!0x1,_0x3b8ad2,_0x2e16a6=()=>{if(_0x4c6b09)throw Error('Middleware\x20for\x20action\x20'+String(_0x32cc7b)+'\x20called\x20next()\x20more\x20than\x20once');return _0x4c6b09=!0x0,_0x3b8ad2=_0x5f0c35(_0x41a624+0x1),_0x3b8ad2;};try{await _0x77fb03(_0x23a08b,_0x2e16a6);}catch(_0x148d28){if(_0x3b8ad2)try{await _0x3b8ad2;}catch{}throw _0x148d28;}if(!_0x4c6b09)throw Error('Middleware\x20for\x20action\x20'+String(_0x32cc7b)+'\x20completed\x20without\x20calling\x20next()');await _0x3b8ad2;};await _0x5f0c35(0x0);}['clear'](){this['_middlewares']['clear']();}},qe={'debug':()=>void 0x0,'info':()=>void 0x0,'warn':()=>void 0x0,'error':()=>void 0x0},Je={'increment':()=>void 0x0,'observe':()=>void 0x0};function Ye(_0x35332e){return _0x35332e?{'debug':(..._0x180b88)=>E(()=>_0x35332e['debug'](..._0x180b88)),'info':(..._0x121787)=>E(()=>_0x35332e['info'](..._0x121787)),'warn':(..._0xe6a777)=>E(()=>_0x35332e['warn'](..._0xe6a777)),'error':(..._0x320928)=>E(()=>_0x35332e['error'](..._0x320928))}:qe;}function Xe(_0x1c45a4){return _0x1c45a4?{'increment':(..._0x4e754a)=>E(()=>_0x1c45a4['increment'](..._0x4e754a)),'observe':(..._0x4eff87)=>E(()=>_0x1c45a4['observe'](..._0x4eff87))}:Je;}function E(_0x14f475){try{_0x14f475();}catch{}}function Ze(_0x552170){return{..._0x552170};}function Qe(_0x182b66){return{..._0x182b66};}function $e(_0x594a66){return{..._0x594a66};}function et(_0x15471e){return{..._0x15471e};}function tt(_0x4bf4d5){return{'unitIDs':_0x4bf4d5['unitIDs'],'hardDelete':_0x4bf4d5['hardDelete']??!0x1};}function nt(_0x5c50aa){return{'unitIDs':_0x5c50aa['unitIDs']};}function rt(_0x2c15b6,_0x26c42e){return{'changeset':{..._0x2c15b6['changeset'],'userID':_0x26c42e['userID'],'memberID':_0x26c42e['memberID']}};}async function it(_0x35341a){let _0x1535f0=ot(),_0xaa0937=(await at(_0x35341a,_0x1535f0['service']))['snapshot']??_0x1535f0['snapshot'];if(!_0xaa0937||_0xaa0937['unitID']!==_0x35341a['data']['id']||_0xaa0937['type']!==_0x35341a['type']||_0xaa0937['rev']!==0x1)throw Error('SDK\x20Unit\x20data\x20transform\x20returned\x20an\x20invalid\x20snapshot');return{'snapshot':_0xaa0937,..._0x1535f0['sheetBlocks']['length']>0x0?{'sheetBlocks':_0x1535f0['sheetBlocks']}:{}};}function at(_0x110072,_0x15c5a1){switch(_0x110072['type']){case c['UniverType']['UNIVER_SHEET']:{let _0x34bfcb=structuredClone(_0x110072['data']);return(0x0,l['transformWorkbookDataToSnapshot'])({},_0x34bfcb,_0x34bfcb['id'],0x1,_0x15c5a1);}case c['UniverType']['UNIVER_DOC']:{let _0x3d617d=structuredClone(_0x110072['data']);return(0x0,l['transformDocumentDataToSnapshot'])({},_0x3d617d,_0x3d617d['id'],0x1,_0x15c5a1);}case c['UniverType']['UNIVER_SLIDE']:{let _0xa35f8f=structuredClone(_0x110072['data']);return(0x0,l['transformSlideDataToSnapshot'])(_0xa35f8f['resources'],_0xa35f8f,_0xa35f8f['id'],0x1,_0x15c5a1);}case c['UniverType']['UNIVER_BOARD']:{let _0x38fa32=structuredClone(_0x110072['data']);return(0x0,l['transformBoardDataToSnapshot'])(_0x38fa32['resources'],_0x38fa32,_0x38fa32['id'],0x1,_0x15c5a1);}case c['UniverType']['UNIVER_BASE']:{let _0x5f3222=structuredClone(_0x110072['data']);return(0x0,l['transformBaseDataToSnapshot'])({},_0x5f3222,_0x5f3222['id'],0x1,_0x15c5a1);}}}function ot(){let _0x2b24b9={},_0x544bdb=[],_0x5c6627={'code':c['ErrorCode']['OK'],'message':''},_0x5529c1=async(_0x513d02,_0x430d4c)=>{if(!_0x430d4c['snapshot'])throw Error('SDK\x20transform\x20attempted\x20to\x20save\x20an\x20empty\x20snapshot');return _0x2b24b9['snapshot']=_0x430d4c['snapshot'],{'error':_0x5c6627};};return{'service':{'saveSnapshot':_0x5529c1,'updateSnapshot':_0x5529c1,'saveSheetBlock':async(_0x44be49,_0x40d994)=>{if(!_0x40d994['block'])throw Error('SDK\x20transform\x20attempted\x20to\x20save\x20an\x20empty\x20block');return _0x544bdb['push'](_0x40d994['block']),{'error':_0x5c6627,'blockID':_0x40d994['block']['id']};}},'sheetBlocks':_0x544bdb,get 'snapshot'(){return _0x2b24b9['snapshot'];}};}function st(_0xc41b55){if(_0xc41b55['type']!==c['UniverType']['UNIVER_SHEET']&&_0xc41b55['type']!==c['UniverType']['UNIVER_BASE'])return[];let _0x50c47b=[],_0x5c638a=new Set();for(let _0x30570d of Object['values'](_0xc41b55['workbook']?.['blockMeta']??{}))for(let _0x22db07 of _0x30570d['blocks'])_0x5c638a['has'](_0x22db07)||(_0x5c638a['add'](_0x22db07),_0x50c47b['push'](_0x22db07));return _0x50c47b;}var D=class{['unitID'];['type'];['_revision'];constructor(_0x29aa41,_0x40c323,_0x5d6bb7){this['unitID']=_0x29aa41,this['type']=_0x40c323,this['_revision']=_0x5d6bb7;}get['revision'](){return this['_revision'];}['advanceTo'](_0x5d6e19){this['_revision']=_0x5d6e19;}},ct=0x64,lt=class{['getAvailableMemory'](){return(0x0,u['getHeapStatistics'])()['total_available_size'];}async['triggerGC'](){globalThis['gc']?globalThis['gc']():await new Promise(_0x4d8400=>{setTimeout(_0x4d8400,ct);});}},ut=class{['_tail']=Promise['resolve']();['enqueue'](_0xc4b976){let _0xcde2fa=this['_tail']['then'](_0xc4b976);return this['_tail']=_0xcde2fa['then'](()=>{},()=>{}),_0xcde2fa;}},dt=class{['_options'];['_memoryService'];['_instances']=new Map();['_idleInstances']=new d['LRUMap'](0x1/0x0);['_loading']=new Map();['_pendingLoads']=new Set();['_loadQueue']=new ut();['_disposed']=!0x1;constructor(_0x164ad6,_0x297588){this['_options']=_0x164ad6,this['_memoryService']=_0x297588;}['getInstance'](_0x3f44c3){return this['_instances']['get'](_0x3f44c3)?.['value'];}['ensureInstance'](_0x4ce269,_0x5a949c){this['_assertOpen']();let _0x5b422e=this['getInstance'](_0x4ce269);if(_0x5b422e)return this['retain'](_0x5b422e),Promise['resolve'](_0x5b422e);let _0x3dd150=this['_loading']['get'](_0x4ce269);if(_0x3dd150)return _0x3dd150['reservation']['refCount']+=0x1,_0x3dd150['promise'];let _0x4af4ab={'refCount':0x1},_0x3c7b43=this['_loadQueue']['enqueue'](async()=>(this['_assertCurrentLoad'](_0x4ce269,_0x4af4ab),await(0x0,ee['setImmediate'])(),this['_loadInstance'](_0x4ce269,_0x5a949c,_0x4af4ab)))['finally'](()=>{this['_loading']['get'](_0x4ce269)?.['reservation']===_0x4af4ab&&this['_loading']['delete'](_0x4ce269),this['_pendingLoads']['delete'](_0x3c7b43);});return this['_loading']['set'](_0x4ce269,{'promise':_0x3c7b43,'reservation':_0x4af4ab}),this['_pendingLoads']['add'](_0x3c7b43),_0x3c7b43;}['retain'](_0x1e60e5){this['_assertOpen']();let _0x281abc=this['_instances']['get'](_0x1e60e5['handle']['unitID']);if(!_0x281abc||_0x281abc['value']!==_0x1e60e5)throw this['_unavailable']();_0x281abc['refCount']+=0x1,this['_idleInstances']['delete'](_0x1e60e5['handle']['unitID']),this['_clearIdleTimer'](_0x281abc);}['release'](_0x4db00a){let _0x5f1bda=_0x4db00a['handle']['unitID'],_0x55d87f=this['_instances']['get'](_0x5f1bda);if(!(!_0x55d87f||_0x55d87f['value']!==_0x4db00a)){if(_0x55d87f['refCount']<0x1)throw Error('Unit\x20instance\x20reference\x20was\x20released\x20more\x20than\x20once');--_0x55d87f['refCount'],_0x55d87f['refCount']===0x0&&(this['_idleInstances']['set'](_0x5f1bda,_0x55d87f),this['_clearIdleTimer'](_0x55d87f),_0x55d87f['idleTimer']=setTimeout(()=>{this['_instances']['get'](_0x5f1bda)===_0x55d87f&&_0x55d87f['refCount']===0x0&&this['disposeInstance'](_0x5f1bda);},this['_options']['idleTimeoutMs']),_0x55d87f['idleTimer']['unref']?.()),this['_evictOverCapacity']();}}['disposeInstance'](_0x14572b){this['_loading']['delete'](_0x14572b);let _0x38638c=this['_instances']['get'](_0x14572b);_0x38638c&&(this['_instances']['delete'](_0x14572b),this['_idleInstances']['delete'](_0x14572b),this['_clearIdleTimer'](_0x38638c),_0x38638c['value']['instance']['dispose']());}async['dispose'](){if(!this['_disposed']){this['_disposed']=!0x0;for(let _0x1671e8 of this['_instances']['keys']())this['disposeInstance'](_0x1671e8);this['_loading']['clear'](),await Promise['allSettled'](this['_pendingLoads']);}}async['_loadInstance'](_0x2e86ec,_0x15dc5d,_0x38fd42){this['_assertCurrentLoad'](_0x2e86ec,_0x38fd42),await this['_checkMemory'](),this['_assertCurrentLoad'](_0x2e86ec,_0x38fd42);let _0x5d5aee=await _0x15dc5d();try{if(this['_assertCurrentLoad'](_0x2e86ec,_0x38fd42),_0x5d5aee['handle']['unitID']!==_0x2e86ec)throw Error('Loaded\x20instance\x20belongs\x20to\x20a\x20different\x20Unit');}catch(_0x302f33){throw _0x5d5aee['instance']['dispose'](),_0x302f33;}return this['_instances']['set'](_0x2e86ec,{'value':_0x5d5aee,'refCount':_0x38fd42['refCount']}),this['_evictOverCapacity'](),_0x5d5aee;}async['_checkMemory'](){let _0x5c04e7=this['_memoryService']['getAvailableMemory'](),_0x29817f=this['_idleInstances']['oldest'];_0x5c04e7<this['_options']['minimumAvailableMemoryBytes']&&_0x29817f&&(this['disposeInstance'](_0x29817f['key']),await this['_memoryService']['triggerGC']());}['_evictOverCapacity'](){for(;this['_instances']['size']>this['_options']['maxLoadedUnits'];){let _0x72d2c0=this['_idleInstances']['oldest'];if(!_0x72d2c0)return;this['disposeInstance'](_0x72d2c0['key']);}}['_clearIdleTimer'](_0x231bf0){_0x231bf0['idleTimer']&&(clearTimeout(_0x231bf0['idleTimer']),delete _0x231bf0['idleTimer']);}['_assertCurrentLoad'](_0x55b26a,_0x391033){if(this['_assertOpen'](),this['_loading']['get'](_0x55b26a)?.['reservation']!==_0x391033)throw this['_unavailable']();}['_assertOpen'](){if(this['_disposed'])throw this['_unavailable']();}['_unavailable'](){return new C('INTERNAL_ERROR','Unit\x20instance\x20is\x20no\x20longer\x20available',{'retryable':!0x0});}};function O(_0x875368,_0x468c16,_0x134fa3){let _0x481d97=new Map(_0x134fa3['map'](_0x598af0=>[_0x598af0['objectId'],_0x598af0])),_0x5afc7e=[];for(let _0x434b4a of _0x468c16){let _0x4cf4db=_0x481d97['get'](_0x434b4a);_0x4cf4db&&_0x5afc7e['push']({'unitID':_0x875368,'objectID':_0x4cf4db['permissionId'],'objectType':_0x4cf4db['objectType'],'action':c['UnitAction']['Edit']});}return _0x5afc7e;}function ft(_0x18f853,_0x51e7b1,_0x108fe2){if(_0x108fe2==='base.mutation.apply-base-json1'&&yt(_0x51e7b1['op']))return pt(_0x18f853,_0x51e7b1['op']);let _0x44c555=new Set(),_0xa69572=k(_0x51e7b1,'table'),_0x40a937=typeof _0x51e7b1['tableId']=='string'?_0x51e7b1['tableId']:_0xa69572[0x0];if(_0xa69572['forEach'](_0x365e19=>_0x44c555['add']((0x0,p['getBaseTablePermissionObjectId'])(_0x365e19))),!_0x40a937)return[..._0x44c555];let _0x503b59=_0x18f853['getSnapshot']()['tables'][_0x40a937],_0x2072f8=new Set(k(_0x51e7b1,'field')),_0x553a63=new Set(k(_0x51e7b1,'record')),_0x3671dd=new Set(k(_0x51e7b1,'view'));return _t(_0x503b59,_0x51e7b1['patches'],_0x553a63,_0x2072f8),vt(_0x51e7b1,_0x2072f8),_0x2072f8['forEach'](_0x4322b0=>_0x44c555['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x40a937,_0x4322b0))),_0x553a63['forEach'](_0x7c3c1f=>_0x44c555['add']((0x0,p['getBaseRecordPermissionObjectId'])(_0x40a937,_0x7c3c1f))),_0x3671dd['forEach'](_0x53ade1=>_0x44c555['add']((0x0,p['getBaseViewPermissionObjectId'])(_0x40a937,_0x53ade1))),[..._0x44c555];}function pt(_0x561651,_0x4bb07a){let _0x1aace3=_0x561651['getSnapshot'](),_0x60b6a5=new p['BaseJson1OpApplier']()['getAffectedRanges'](_0x4bb07a),_0x4ddeb4=mt(_0x4bb07a),_0x55e5a4=new Set();return _0x60b6a5['forEach'](_0x1f8ec9=>{let {tableId:_0x35a17e}=_0x1f8ec9;if(!_0x35a17e)return;_0x55e5a4['add']((0x0,p['getBaseTablePermissionObjectId'])(_0x35a17e));let _0xae0304=_0x1aace3['tables'][_0x35a17e],_0xb5000c=_0x1f8ec9['recordId']??(_0x1f8ec9['row']==null?void 0x0:_0xae0304?.['rowId']?.[_0x1f8ec9['row']]),_0x2316cf=_0x1f8ec9['fieldId']??(_0x1f8ec9['column']==null?void 0x0:_0xae0304?.['colId']?.[_0x1f8ec9['column']]);_0xb5000c&&_0x55e5a4['add']((0x0,p['getBaseRecordPermissionObjectId'])(_0x35a17e,_0xb5000c)),_0x2316cf&&_0x55e5a4['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x35a17e,_0x2316cf)),_0x1f8ec9['viewId']&&_0x55e5a4['add']((0x0,p['getBaseViewPermissionObjectId'])(_0x35a17e,_0x1f8ec9['viewId'])),(_0x1f8ec9['reason']==='table'||_0x4ddeb4['has'](_0x35a17e))&&_0xae0304&&(Object['keys'](_0xae0304['fields'])['forEach'](_0x5c6b88=>_0x55e5a4['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x35a17e,_0x5c6b88))),Object['keys'](_0xae0304['records'])['forEach'](_0x15e839=>_0x55e5a4['add']((0x0,p['getBaseRecordPermissionObjectId'])(_0x35a17e,_0x15e839))),Object['keys'](_0xae0304['views'])['forEach'](_0x2cb729=>_0x55e5a4['add']((0x0,p['getBaseViewPermissionObjectId'])(_0x35a17e,_0x2cb729)))),_0x1f8ec9['reason']==='record'&&_0xae0304&&Object['keys'](_0xae0304['fields'])['forEach'](_0xfe2a09=>_0x55e5a4['add']((0x0,p['getBaseFieldPermissionObjectId'])(_0x35a17e,_0xfe2a09)));}),_0x60b6a5['length']===0x0&&gt(_0x4bb07a,'tableOrder')&&Object['keys'](_0x1aace3['tables'])['forEach'](_0x1f4141=>_0x55e5a4['add']((0x0,p['getBaseTablePermissionObjectId'])(_0x1f4141))),[..._0x55e5a4];}function mt(_0x4dbc1f){let _0x5a8464=new Set(),_0x3df764=_0x3044dc=>{Array['isArray'](_0x3044dc)&&_0x3044dc['forEach']((_0x547490,_0x2c57fa)=>{_0x547490==='tables'&&typeof _0x3044dc[_0x2c57fa+0x1]=='string'&&ht(_0x3044dc[_0x2c57fa+0x2])&&_0x5a8464['add'](_0x3044dc[_0x2c57fa+0x1]),_0x3df764(_0x547490);});};return _0x3df764(_0x4dbc1f),_0x5a8464;}function ht(_0x31ade8){return!!_0x31ade8&&typeof _0x31ade8=='object'&&!Array['isArray'](_0x31ade8)&&('i'in _0x31ade8||'r'in _0x31ade8||'p'in _0x31ade8||'d'in _0x31ade8||'es'in _0x31ade8||'ena'in _0x31ade8||'et'in _0x31ade8);}function gt(_0x5861c0,_0x499efb){return Array['isArray'](_0x5861c0)&&_0x5861c0['some'](_0x58d830=>_0x58d830===_0x499efb||gt(_0x58d830,_0x499efb));}function k(_0x2ea19a,_0x21c3d7){let _0x3758a8=new Set(),_0xc0a86c=_0x21c3d7+'Id',_0x1e9147=_0x21c3d7+'Ids',_0x1e8dd5=(_0x19d429,_0x2cb275='')=>{if(typeof _0x19d429=='string'){_0x2cb275===_0xc0a86c&&_0x3758a8['add'](_0x19d429);return;}if(Array['isArray'](_0x19d429)){_0x2cb275===_0x1e9147?_0x19d429['forEach'](_0x912108=>{typeof _0x912108=='string'&&_0x3758a8['add'](_0x912108);}):_0x19d429['forEach'](_0x2658b8=>_0x1e8dd5(_0x2658b8,_0x2cb275));return;}bt(_0x19d429)&&Object['entries'](_0x19d429)['forEach'](([_0x372166,_0x527373])=>{_0x372166==='id'&&_0x2cb275===_0x21c3d7&&typeof _0x527373=='string'?_0x3758a8['add'](_0x527373):_0x1e8dd5(_0x527373,_0x372166);});};return _0x1e8dd5(_0x2ea19a),[..._0x3758a8];}function _t(_0x372053,_0x65fdfc,_0x16f1ff,_0x12ff20){!_0x372053||!Array['isArray'](_0x65fdfc)||_0x65fdfc['forEach'](_0x45e202=>{if(!bt(_0x45e202))return;let _0x3438f9=_0x45e202;if(typeof _0x3438f9['row']=='number'){let _0x2a99e7=_0x372053['rowId']?.[_0x3438f9['row']];_0x2a99e7&&_0x16f1ff['add'](_0x2a99e7);}if(typeof _0x3438f9['col']=='number'){let _0x4bf937=_0x372053['colId']?.[_0x3438f9['col']];_0x4bf937&&_0x12ff20['add'](_0x4bf937);}});}function vt(_0x4fefd1,_0x202637,_0x39b826=''){if(!(!_0x4fefd1||typeof _0x4fefd1!='object')){if(Array['isArray'](_0x4fefd1)){_0x4fefd1['forEach'](_0x314072=>vt(_0x314072,_0x202637,_0x39b826));return;}bt(_0x4fefd1)&&Object['entries'](_0x4fefd1)['forEach'](([_0x597c99,_0x90cb48])=>{_0x39b826==='values'&&_0x202637['add'](_0x597c99),vt(_0x90cb48,_0x202637,_0x597c99);});}}function yt(_0x484dfe){return Array['isArray'](_0x484dfe);}function bt(_0x533fc9){return typeof _0x533fc9=='object'&&!!_0x533fc9&&!Array['isArray'](_0x533fc9);}function A(_0x443964,_0x28969c,_0x1c40e9){let _0xfa7b7c=_0x443964['get'](d['IResourceManagerService'])['getAllResourceHooks']()['find'](_0x190452=>_0x190452['pluginName']===_0x1c40e9['name']&&_0x190452['businesses']['includes'](_0x1c40e9['business']));if(!_0xfa7b7c)throw new C('INTERNAL_ERROR',_0x1c40e9['label']+'\x20permission\x20resource\x20is\x20not\x20registered');try{let _0x51c50f=JSON['parse'](_0xfa7b7c['toJson'](_0x28969c));if(!Array['isArray'](_0x51c50f)||!_0x51c50f['every'](_0x1f7b33=>xt(_0x1f7b33,_0x1c40e9['objectTypes'])))throw Error('Invalid\x20'+_0x1c40e9['label']+'\x20permission\x20bindings');let _0x9c624c=new Set();for(let _0x542a70 of _0x51c50f){let _0x271786=_0x542a70['objectType']+'/'+_0x542a70['objectId'];if(_0x9c624c['has'](_0x271786))throw Error('Duplicate\x20'+_0x1c40e9['label']+'\x20permission\x20binding');_0x9c624c['add'](_0x271786);}return _0x51c50f;}catch(_0xe2efe8){throw new C('INTERNAL_ERROR','Failed\x20to\x20read\x20'+_0x1c40e9['label']+'\x20permission\x20bindings',{'cause':_0xe2efe8});}}function xt(_0x4bbab5,_0x222d1b){if(!_0x4bbab5||typeof _0x4bbab5!='object')return!0x1;let _0xe0db67=_0x4bbab5;return typeof _0xe0db67['objectId']=='string'&&_0xe0db67['objectId']['length']>0x0&&typeof _0xe0db67['permissionId']=='string'&&_0xe0db67['permissionId']['length']>0x0&&_0xe0db67['objectType']!==void 0x0&&_0x222d1b['has'](_0xe0db67['objectType']);}var St={'name':'BASE_OBJECT_PERMISSION_PLUGIN','business':d['UniverInstanceType']['UNIVER_BASE'],'objectTypes':new Set([c['UnitObject']['BaseTable'],c['UnitObject']['BaseField'],c['UnitObject']['BaseRecord'],c['UnitObject']['BaseView'],c['UnitObject']['BaseDashboard']]),'label':'Base'};function Ct(_0x445f4d,_0xfed041){return A(_0x445f4d,_0xfed041,St);}var wt=new Set(['base-dashboard.mutation.patch-dashboard','base-dashboard.mutation.remove-dashboard','base-dashboard.mutation.set-dashboard']);function Tt(_0x48489e,_0x14b505,_0x577cdc){if(_0x577cdc['id']['startsWith']('thread-comment.mutation.'))return[{'unitID':_0x14b505,'objectID':_0x14b505,'objectType':c['UnitObject']['Base'],'action':c['UnitAction']['Comment']}];let _0x3f5dab=_0x577cdc['params'],_0x144df5;if(wt['has'](_0x577cdc['id'])){let _0x2bf0e8=_0x3f5dab['dashboard'],_0x287a29=typeof _0x3f5dab['dashboardId']=='string'?_0x3f5dab['dashboardId']:_0x2bf0e8?.['id'];_0x144df5=new Set(typeof _0x287a29=='string'?[(0x0,p['getBaseDashboardPermissionObjectId'])(_0x287a29)]:[]);}else{if(_0x577cdc['id']['startsWith']('base.mutation.')){let _0x37dcb6=_0x48489e['get'](d['IUniverInstanceService'])['getUnit'](_0x14b505,d['UniverInstanceType']['UNIVER_BASE']);_0x144df5=new Set(ft(_0x37dcb6,_0x3f5dab,_0x577cdc['id']));}else return[];}return _0x144df5['size']===0x0?[]:O(_0x14b505,_0x144df5,Ct(_0x48489e,_0x14b505));}function Et(_0x1b7656,_0x11f5a1){let _0x539fe2=typeof _0x11f5a1?.['subUnitId']=='string'?_0x11f5a1['subUnitId']:_0x1b7656['getActivePageId'](),_0x408619=_0x1b7656['getSnapshot']()['pages'][_0x539fe2]?.['elements']??{},_0x37457b=new Set(Dt(_0x11f5a1)),_0x1e5e69=Ot(_0x11f5a1);return _0x1e5e69['size']&&Object['values'](_0x408619)['forEach'](_0x3a63d8=>{if(!N(_0x3a63d8)||typeof _0x3a63d8['id']!='string')return;let _0x5e170b=_0x3a63d8;(_0x1e5e69['has'](String(_0x5e170b['chartId']??''))||_0x1e5e69['has'](String(_0x5e170b['tableId']??'')))&&_0x37457b['add'](_0x5e170b['id']);}),[...kt(_0x408619,_0x37457b)]['map'](_0x13367f=>(0x0,re['getBoardElementPermissionObjectId'])(_0x539fe2,_0x13367f));}function Dt(_0x2d774d,_0x5202be=''){let _0x35762d=new Set();return M(_0x2d774d,_0x5202be,_0x35762d),[..._0x35762d];}function Ot(_0x3854ba,_0x2a7362='',_0x37aad0=new Set()){return N(_0x3854ba)?Array['isArray'](_0x3854ba)?(_0x3854ba['forEach'](_0x207e9c=>Ot(_0x207e9c,_0x2a7362,_0x37aad0)),_0x37aad0):(Object['entries'](_0x3854ba)['forEach'](([_0x3ea078,_0x336fa7])=>{(_0x3ea078==='chartId'||_0x3ea078==='tableId')&&typeof _0x336fa7=='string'&&_0x37aad0['add'](_0x336fa7),_0x3ea078==='id'&&(_0x2a7362==='chart'||_0x2a7362==='table')&&typeof _0x336fa7=='string'&&_0x37aad0['add'](_0x336fa7),Ot(_0x336fa7,_0x3ea078,_0x37aad0);}),_0x37aad0):_0x37aad0;}function kt(_0x5431e1,_0x3821cd){let _0x1059e1=new Set(_0x3821cd),_0x14618d=Object['values'](_0x5431e1)['filter'](N)['filter'](_0x59291a=>typeof _0x59291a['id']=='string'),_0x5d8149=_0x406aba=>{let _0x316ea8=_0x5431e1[_0x406aba];!_0x316ea8||typeof _0x316ea8!='object'||j(_0x316ea8,/^(parentId|groupId|parentNodeId|structureScopeId)$/i)['forEach'](_0x1613cf=>{_0x1059e1['has'](_0x1613cf)||!_0x5431e1[_0x1613cf]||(_0x1059e1['add'](_0x1613cf),_0x5d8149(_0x1613cf));});};_0x3821cd['forEach'](_0x5d8149);let _0x3baf82=new Set(_0x3821cd),_0x17ed54=!0x0;for(;_0x17ed54;)_0x17ed54=!0x1,_0x14618d['forEach'](_0x393fbb=>{_0x3baf82['has'](_0x393fbb['id'])||j(_0x393fbb,/(?:parent|group|child|owner|root|start|end|from|to|bound|structureScope).*(?:Id|Ids)$/i)['some'](_0x450e38=>_0x3baf82['has'](_0x450e38))&&(_0x3baf82['add'](_0x393fbb['id']),_0x1059e1['add'](_0x393fbb['id']),_0x17ed54=!0x0);});return _0x1059e1;}function j(_0x4b8282,_0x5f08aa,_0x451c6b='',_0x5a97c2=new Set()){return typeof _0x4b8282=='string'?(_0x5f08aa['test'](_0x451c6b)&&_0x5a97c2['add'](_0x4b8282),[..._0x5a97c2]):Array['isArray'](_0x4b8282)?(_0x5f08aa['test'](_0x451c6b)?_0x4b8282['forEach'](_0x300804=>{typeof _0x300804=='string'&&_0x5a97c2['add'](_0x300804);}):_0x4b8282['forEach'](_0x5099b0=>j(_0x5099b0,_0x5f08aa,_0x451c6b,_0x5a97c2)),[..._0x5a97c2]):(N(_0x4b8282)&&Object['entries'](_0x4b8282)['forEach'](([_0x342d4a,_0x32645e])=>j(_0x32645e,_0x5f08aa,_0x342d4a,_0x5a97c2)),[..._0x5a97c2]);}function M(_0x15e4d4,_0x58cfb4,_0x4a4892){if(typeof _0x15e4d4=='string'){/^(elementId|drawingId|connectorId|containerId|swimlaneId|[a-z]*nodeId)$/i['test'](_0x58cfb4)&&_0x4a4892['add'](_0x15e4d4);return;}if(Array['isArray'](_0x15e4d4)){/^(element|drawing|connector|container|swimlane|[a-z]*node)Ids$/i['test'](_0x58cfb4)?_0x15e4d4['forEach'](_0x25b96e=>{typeof _0x25b96e=='string'&&_0x4a4892['add'](_0x25b96e);}):_0x15e4d4['forEach'](_0x17fe0a=>M(_0x17fe0a,_0x58cfb4,_0x4a4892));return;}N(_0x15e4d4)&&Object['entries'](_0x15e4d4)['forEach'](([_0x433fab,_0x36006f])=>{_0x433fab==='id'&&(_0x58cfb4==='element'||_0x58cfb4==='elements')?typeof _0x36006f=='string'&&_0x4a4892['add'](_0x36006f):M(_0x36006f,_0x433fab,_0x4a4892);});}function N(_0x5cf23c){return typeof _0x5cf23c=='object'&&!!_0x5cf23c&&!Array['isArray'](_0x5cf23c);}var At={'name':'BOARD_OBJECT_PERMISSION_PLUGIN','business':d['UniverInstanceType']['UNIVER_BOARD'],'objectTypes':new Set([c['UnitObject']['BoardElement']]),'label':'Board'};function jt(_0x391dea,_0x4c14f7){return A(_0x391dea,_0x4c14f7,At);}function Mt(_0x4e4c19,_0x569549,_0x5e4add){if(_0x5e4add['id']['startsWith']('thread-comment.mutation.'))return[{'unitID':_0x569549,'objectID':_0x569549,'objectType':c['UnitObject']['Board'],'action':c['UnitAction']['Comment']}];if(!_0x5e4add['id']['startsWith']('board.mutation.'))return[];let _0x5458f6=_0x5e4add['params'];if(_0x5e4add['id']==='board.mutation.update-element'&&_0x5458f6['formulaLastValueGuard'])return[];let _0x5bc9c7=_0x4e4c19['get'](d['IUniverInstanceService'])['getUnit'](_0x569549,d['UniverInstanceType']['UNIVER_BOARD']),_0x4c938a=new Set(Et(_0x5bc9c7,_0x5458f6));return _0x4c938a['size']===0x0?[]:O(_0x569549,_0x4c938a,jt(_0x4e4c19,_0x569549));}var Nt=['defaultHeaderId','defaultFooterId','firstPageHeaderId','firstPageFooterId','evenPageHeaderId','evenPageFooterId'],Pt=new WeakMap();function P(_0x4b4bb5){let _0x3a0ed6=_0x4b4bb5['getMutationRevision']?.()??NaN,_0x2262a0=Pt['get'](_0x4b4bb5);if(_0x2262a0?.['mutationRevision']===_0x3a0ed6)return _0x2262a0;let _0x4c5c61=_0x4b4bb5['getSnapshot'](),_0x22dd3f=_0x4c5c61['body']?(0x0,m['getTopLevelSectionBreaks'])(_0x4c5c61['body']):[],_0x2fd5bb=new Map(),_0x3dffef=(_0x569909,_0x4c0245)=>{for(let _0x112f30 of _0x569909?.['customBlocks']??[])_0x2fd5bb['has'](_0x112f30['blockId'])||_0x2fd5bb['set'](_0x112f30['blockId'],_0x4c0245);};_0x3dffef(_0x4c5c61['body'],''),Object['entries'](_0x4c5c61['headers']??{})['forEach'](([_0x3919c0,_0x1e475e])=>_0x3dffef(_0x1e475e['body'],_0x3919c0)),Object['entries'](_0x4c5c61['footers']??{})['forEach'](([_0x20a928,_0x1b0282])=>_0x3dffef(_0x1b0282['body'],_0x20a928)),Object['entries'](_0x4c5c61['notes']??{})['forEach'](([_0x5ee33d,_0x364461])=>_0x3dffef(_0x364461['body'],_0x5ee33d));let _0x346e9f=new Map();for(let _0x5790cf of _0x4c5c61['body']?.['customRanges']??[])(_0x5790cf['rangeType']===d['CustomRangeType']['FOOTNOTE']||_0x5790cf['rangeType']===d['CustomRangeType']['ENDNOTE'])&&typeof _0x5790cf['properties']?.['noteId']=='string'&&_0x346e9f['set'](_0x5790cf['properties']['noteId'],{'startOffset':_0x5790cf['startIndex'],'endOffset':_0x5790cf['endIndex']+0x1});let _0x46db63={'drawingSegmentIds':_0x2fd5bb,'footnoteReferenceRanges':_0x346e9f,'mutationRevision':_0x3a0ed6,'segments':new Map(),'topLevelSections':_0x22dd3f};return Pt['set'](_0x4b4bb5,_0x46db63),_0x46db63;}function Ft(_0x535228,_0x28b845,_0x19c066=P(_0x535228)){let _0x2b95b9=_0x19c066['segments']['get'](_0x28b845);if(_0x2b95b9)return _0x2b95b9;let _0x3ac728=_0x535228['getSelfOrHeaderFooterModel'](_0x28b845)?.['getBody']()??null,_0x2662bc=_0x535228['getSnapshot'](),_0x2e7cd9=_0x2662bc['notes']?.[_0x28b845],_0x3df66b=(_0x2e7cd9?_0x2e7cd9['drawings']:_0x2662bc['drawings'])??{},_0x87d07f=_0x3ac728==null?[]:[...(_0x3ac728['tables']??[])['map'](_0x416d92=>({'type':'table','id':_0x416d92['tableId'],'startOffset':_0x416d92['startIndex'],'endOffset':_0x416d92['endIndex']})),...(_0x3ac728['customBlocks']??[])['map'](_0x16b50e=>({'type':_0x3df66b[_0x16b50e['blockId']]?'drawing':'custom-block','id':_0x16b50e['blockId'],'startOffset':_0x16b50e['startIndex'],'endOffset':_0x16b50e['startIndex']+0x1})),...(_0x3ac728['blockRanges']??[])['map'](_0x2d293b=>({'type':'block-range','id':_0x2d293b['blockId'],'startOffset':_0x2d293b['startIndex'],'endOffset':_0x2d293b['endIndex']+0x1})),...(_0x3ac728['customRanges']??[])['map'](_0x24acb6=>({'type':'custom-range','id':_0x24acb6['rangeId'],'startOffset':_0x24acb6['startIndex'],'endOffset':_0x24acb6['endIndex']+0x1})),...(_0x3ac728['columnGroups']??[])['map'](_0x3d3d42=>({'type':'column-group','id':_0x3d3d42['columnGroupId'],'startOffset':_0x3d3d42['startIndex'],'endOffset':_0x3d3d42['endIndex']+0x1}))],_0x8b1222=new Map(_0x87d07f['map'](_0x322366=>[_0x322366['type']+':'+_0x322366['id'],{'startOffset':_0x322366['startOffset'],'endOffset':_0x322366['endOffset']}]));for(let _0x527aee of _0x3ac728?.['customBlocks']??[]){let _0x112cb2={'startOffset':_0x527aee['startIndex'],'endOffset':_0x527aee['startIndex']+0x1};_0x8b1222['set']('custom-block:'+_0x527aee['blockId'],_0x112cb2),_0x8b1222['set']('drawing:'+_0x527aee['blockId'],_0x112cb2);}let _0x4cfee7={'body':_0x3ac728,'entities':_0x87d07f,'entityRanges':_0x8b1222,'paragraphContentStartOffsets':_0x3ac728==null?new Map():(0x0,d['getParagraphContentStartOffsets'])(_0x3ac728),'paragraphsById':new Map((_0x3ac728?.['paragraphs']??[])['filter'](_0x4f41a8=>_0x4f41a8['paragraphId']!=null)['map'](_0x2da8b4=>[_0x2da8b4['paragraphId'],_0x2da8b4]))};return _0x19c066['segments']['set'](_0x28b845,_0x4cfee7),_0x4cfee7;}function It(_0x1c14f2,_0x4e9689){return P(_0x1c14f2)['drawingSegmentIds']['get'](_0x4e9689)??'';}function Lt(_0x75f227,_0x20257b,_0x411404){let _0x19b882=P(_0x75f227),_0x12f2c6=Ft(_0x75f227,_0x20257b,_0x19b882),{body:_0xbfd797}=_0x12f2c6;return _0xbfd797?[...I(_0x75f227,_0x20257b,_0x411404,_0x19b882),...Ht(_0xbfd797,_0x20257b,_0x411404,_0x12f2c6),...Ut(_0x20257b,_0x411404,_0x12f2c6)]:[];}function Rt(_0x9528cf,_0x19cb1f,_0x3d24e7){let _0x5bdf13=new Set();if(_0x3d24e7==null)return[];let _0x4fa72e=d['JSON1']['type']['readCursor'](_0x3d24e7);return _0x4fa72e['traverse'](null,()=>{let _0x321fa8=_0x4fa72e['getPath'](),_0x198600=_0x4fa72e['getComponent'](),_0x580e0f=['headers','footers','notes']['includes'](String(_0x321fa8[0x0]))&&typeof _0x321fa8[0x1]=='string'?_0x321fa8[0x1]:_0x19cb1f;if(_0x321fa8[0x0]==='notes'&&typeof _0x321fa8[0x1]=='string'&&I(_0x9528cf,_0x321fa8[0x1],{'startOffset':0x0,'endOffset':0x0})['forEach'](_0x5d02d9=>_0x5bdf13['add'](_0x5d02d9)),_0x321fa8[0x0]==='noteSettings'&&P(_0x9528cf)['topLevelSections']['forEach'](_0x2de764=>{_0x5bdf13['add']((0x0,m['getDocumentSectionPermissionObjectId'])('',_0x2de764['sectionId']));}),_0x321fa8[0x0]==='body'&&_0x321fa8[0x1]==='sectionBreaks'&&typeof _0x321fa8[0x2]=='number'&&(_0x321fa8[0x3]==='noteProperties'||_0x321fa8[0x3]==='suppressEndnotes')){let _0xa85655=_0x9528cf['getBody']()?.['sectionBreaks']?.[_0x321fa8[0x2]]?.['sectionId'];_0xa85655&&_0x5bdf13['add']((0x0,m['getDocumentSectionPermissionObjectId'])('',_0xa85655));}if(_0x321fa8[_0x321fa8['length']-0x1]!=='body'||_0x198600?.['et']!==d['TextX']['id']||!Array['isArray'](_0x198600['e'])||!_0x198600['e']['every'](Bt))return;let _0x2fbbf9=_0x198600['e'],_0x13c1b1=0x0,_0x4fb4a9=(_0x326231,_0x52b1f7)=>{Lt(_0x9528cf,_0x580e0f,{'startOffset':_0x326231,'endOffset':_0x52b1f7})['forEach'](_0x4da8f1=>_0x5bdf13['add'](_0x4da8f1));};_0x2fbbf9['forEach'](_0x58891f=>{if(_0x58891f['t']===d['TextXActionType']['INSERT']){_0x4fb4a9(_0x13c1b1,_0x13c1b1);return;}if(_0x58891f['t']===d['TextXActionType']['DELETE']){_0x4fb4a9(_0x13c1b1,_0x13c1b1+_0x58891f['len']),_0x13c1b1+=_0x58891f['len'];return;}(_0x58891f['body']!==void 0x0||_0x58891f['oldBody']!==void 0x0||_0x58891f['coverType']!==void 0x0)&&_0x4fb4a9(_0x13c1b1,_0x13c1b1+_0x58891f['len']),_0x13c1b1+=_0x58891f['len'];});}),zt(_0x3d24e7)['forEach'](_0x4a3092=>{_0x5bdf13['add']((0x0,m['getDocumentEntityPermissionObjectId'])(_0x19cb1f,'drawing',_0x4a3092));let _0x55fdc8=(_0x9528cf['getSelfOrHeaderFooterModel'](_0x19cb1f)?.['getBody']())?.['customBlocks']?.['find'](_0x30bc67=>_0x30bc67['blockId']===_0x4a3092);_0x55fdc8&&I(_0x9528cf,_0x19cb1f,{'startOffset':_0x55fdc8['startIndex'],'endOffset':_0x55fdc8['startIndex']+0x1})['forEach'](_0x24087e=>_0x5bdf13['add'](_0x24087e));}),[..._0x5bdf13];}function zt(_0x486073){let _0x4a607b=new Set(),_0x100677=_0x550277=>{if(Array['isArray'](_0x550277)){_0x550277['forEach']((_0x461462,_0x45900a)=>{_0x461462==='drawings'&&typeof _0x550277[_0x45900a+0x1]=='string'&&_0x4a607b['add'](_0x550277[_0x45900a+0x1]),_0x100677(_0x461462);});return;}F(_0x550277)&&Object['values'](_0x550277)['forEach'](_0x100677);};return _0x100677(_0x486073),[..._0x4a607b];}function Bt(_0x2c1e3d){return!F(_0x2c1e3d)||typeof _0x2c1e3d['len']!='number'?!0x1:_0x2c1e3d['t']===d['TextXActionType']['INSERT']?F(_0x2c1e3d['body']):_0x2c1e3d['t']===d['TextXActionType']['RETAIN']||_0x2c1e3d['t']===d['TextXActionType']['DELETE'];}function F(_0x80379c){return typeof _0x80379c=='object'&&!!_0x80379c&&!Array['isArray'](_0x80379c);}function Vt(_0x3ce10f,_0x5620c5,_0x3dabe5,_0x437fc0){let _0x2282b8=P(_0x3ce10f),_0x513bb8=Ft(_0x3ce10f,_0x5620c5,_0x2282b8)['entityRanges']['get'](_0x3dabe5+':'+_0x437fc0)??null;return _0x513bb8?I(_0x3ce10f,_0x5620c5,_0x513bb8,_0x2282b8):[];}function I(_0x46764e,_0x453884,_0x216af1,_0xbf329c=P(_0x46764e)){if(_0x453884){let _0x32de50=_0xbf329c['footnoteReferenceRanges']['get'](_0x453884);return _0x32de50?Lt(_0x46764e,'',_0x32de50):Gt(_0x46764e,_0x453884,_0xbf329c['topLevelSections'])['map'](_0x5d393c=>(0x0,m['getDocumentSectionPermissionObjectId'])('',_0x5d393c));}return Wt(_0xbf329c['topLevelSections'],_0x216af1)['map'](_0x42d568=>(0x0,m['getDocumentSectionPermissionObjectId'])('',_0x42d568['sectionId']));}function Ht(_0x591309,_0x39a453,_0x19b968,_0x748a78){let _0x1d9236=Math['min'](_0x19b968['startOffset'],_0x19b968['endOffset']),_0x1b6c5b=Math['max'](_0x19b968['startOffset'],_0x19b968['endOffset']);return(_0x591309['paragraphs']??[])['filter'](_0x29f222=>L(_0x748a78['paragraphContentStartOffsets']['get'](_0x29f222['startIndex'])??(0x0,d['getParagraphContentStartOffset'])(_0x591309,_0x29f222),_0x29f222['startIndex']+0x1,_0x1d9236,_0x1b6c5b))['flatMap'](_0x4ab6e4=>_0x4ab6e4['paragraphId']?[(0x0,m['getDocumentParagraphPermissionObjectId'])(_0x39a453,_0x4ab6e4['paragraphId'])]:[]);}function Ut(_0x3e701b,_0x306e99,_0x2aced4){let _0xe3b313=Math['min'](_0x306e99['startOffset'],_0x306e99['endOffset']),_0x4bd584=Math['max'](_0x306e99['startOffset'],_0x306e99['endOffset']);return _0x2aced4['entities']['filter'](_0x33b5e1=>L(_0x33b5e1['startOffset'],_0x33b5e1['endOffset'],_0xe3b313,_0x4bd584))['map'](_0x3098b3=>(0x0,m['getDocumentEntityPermissionObjectId'])(_0x3e701b,_0x3098b3['type'],_0x3098b3['id']));}function Wt(_0x43d03a,_0x90349e){let _0x5c0bce=Math['min'](_0x90349e['startOffset'],_0x90349e['endOffset']),_0x13e231=Math['max'](_0x90349e['startOffset'],_0x90349e['endOffset']);return _0x43d03a['filter']((_0x57184e,_0x149a0c)=>L(_0x149a0c===0x0?0x0:_0x43d03a[_0x149a0c-0x1]['startIndex']+0x1,_0x57184e['startIndex']+0x1,_0x5c0bce,_0x13e231));}function L(_0x3dc631,_0x4284af,_0x39f808,_0x44e6f8){return _0x39f808===_0x44e6f8?_0x39f808>=_0x3dc631&&_0x39f808<_0x4284af:_0x39f808<_0x4284af&&_0x44e6f8>_0x3dc631;}function Gt(_0x5b183a,_0x126d5c,_0x45271d=P(_0x5b183a)['topLevelSections']){let _0x1cfcc0=_0x5b183a['getSnapshot'](),_0x18c4bc=new Set();return _0x45271d['forEach']((_0xd46f1,_0xee2cd)=>{Nt['some'](_0x1382fc=>(0x0,d['resolveSectionHeaderFooterReference'])(_0x1cfcc0['documentStyle'],_0x45271d,_0xee2cd,_0x1382fc)['segmentId']===_0x126d5c)&&_0x18c4bc['add'](_0xd46f1['sectionId']);}),[..._0x18c4bc];}function Kt(_0xfb9248,_0x165e3b){let _0x1fc51d=R(_0x165e3b['params'])?_0x165e3b['params']:void 0x0;if(_0x165e3b['id']===m['RichTextEditingMutation']['id']){let _0x26853e=_0x165e3b['params'];return Rt(_0xfb9248,_0x26853e['segmentId']??'',_0x26853e['actions']);}return _0x165e3b['id']==='doc.mutation.rename-doc'||_0x165e3b['id']==='docs-formula.mutation.set-last-values'||_0x165e3b['id']==='doc.mutation.update-shape-data'&&_0x1fc51d?.['formulaLastValueGuard']?[]:qt(_0xfb9248,_0x165e3b);}function qt(_0xb73671,_0x28a4bf){let _0x8a2b18=_0x28a4bf['params'];if(!R(_0x8a2b18))return[];let _0x39c231=new Set(),_0x83a5fc=(_0x22da7c,_0x2d11c3,_0x536ebc)=>{_0x39c231['add']((0x0,m['getDocumentEntityPermissionObjectId'])(_0x22da7c,_0x2d11c3,_0x536ebc)),Vt(_0xb73671,_0x22da7c,_0x2d11c3,_0x536ebc)['forEach'](_0x1abb83=>_0x39c231['add'](_0x1abb83));};return Jt(_0x8a2b18)['forEach'](({entityType:_0x1e978e,entityId:_0x1b72f1})=>{let _0x498a37=_0x8a2b18['segmentId'],_0x5061fa=typeof _0x498a37=='string'?_0x498a37:_0x1e978e==='drawing'||_0x1e978e==='custom-block'?It(_0xb73671,_0x1b72f1):'';_0x83a5fc(_0x5061fa,_0x1e978e,_0x1b72f1);}),[..._0x39c231];}function Jt(_0x54d16d){let _0x3d9f72=new Map(),_0x15526c={'blockId':['custom-block'],'drawingId':['drawing'],'shapeId':['drawing','custom-block'],'tableId':['table'],'rangeId':['custom-range'],'columnGroupId':['column-group']},_0x2e85d1=(_0x2960b1,_0x152f24='')=>{if(typeof _0x2960b1=='string'){_0x15526c[_0x152f24]?.['forEach'](_0xc9f5c1=>{_0x3d9f72['set'](_0xc9f5c1+'\x1f'+_0x2960b1,{'entityType':_0xc9f5c1,'entityId':_0x2960b1});});return;}if(Array['isArray'](_0x2960b1)){let _0x17604=_0x152f24['endsWith']('Ids')?_0x152f24['slice'](0x0,-0x3)+'Id':_0x152f24;_0x2960b1['forEach'](_0x41910d=>_0x2e85d1(_0x41910d,_0x17604));return;}R(_0x2960b1)&&Object['entries'](_0x2960b1)['forEach'](([_0x18f638,_0x4e883b])=>_0x2e85d1(_0x4e883b,_0x18f638));};return _0x2e85d1(_0x54d16d),[..._0x3d9f72['values']()];}function R(_0x5c168e){return typeof _0x5c168e=='object'&&!!_0x5c168e&&!Array['isArray'](_0x5c168e);}var Yt={'name':'DOC_OBJECT_PERMISSION_PLUGIN','business':d['UniverInstanceType']['UNIVER_DOC'],'objectTypes':new Set([c['UnitObject']['DocumentSection'],c['UnitObject']['DocumentParagraph'],c['UnitObject']['DocumentEntity']]),'label':'Document'};function Xt(_0x3a3586,_0x52e7c5){return A(_0x3a3586,_0x52e7c5,Yt);}function Zt(_0x5df3bb,_0x4238cb,_0x3008fc){if(_0x3008fc['id']['startsWith']('thread-comment.mutation.'))return[{'unitID':_0x4238cb,'objectID':_0x4238cb,'objectType':c['UnitObject']['Document'],'action':c['UnitAction']['Comment']}];let _0x415f64=_0x5df3bb['get'](d['IUniverInstanceService'])['getUnit'](_0x4238cb,d['UniverInstanceType']['UNIVER_DOC']),_0x4635c8=new Set(Kt(_0x415f64,_0x3008fc));return _0x4635c8['size']===0x0?[]:O(_0x4238cb,_0x4635c8,Xt(_0x5df3bb,_0x4238cb));}function Qt(_0x32ac19){let {startRow:_0x316a9d,startColumn:_0x5416be,endRow:_0x567f84,endColumn:_0x3358dd,rangeType:_0x27bacd}=_0x32ac19;return(Number['isNaN'](_0x316a9d)||[d['RANGE_TYPE']['ALL'],d['RANGE_TYPE']['COLUMN']]['includes'](_0x27bacd))&&(_0x32ac19['startRow']=0x0),(Number['isNaN'](_0x567f84)||[d['RANGE_TYPE']['ALL'],d['RANGE_TYPE']['COLUMN']]['includes'](_0x27bacd))&&(_0x32ac19['endRow']=d['MAX_ROW_COUNT']-0x1),(Number['isNaN'](_0x5416be)||[d['RANGE_TYPE']['ALL'],d['RANGE_TYPE']['ROW']]['includes'](_0x27bacd))&&(_0x32ac19['startColumn']=0x0),(Number['isNaN'](_0x3358dd)||[d['RANGE_TYPE']['ALL'],d['RANGE_TYPE']['ROW']]['includes'](_0x27bacd))&&(_0x32ac19['endColumn']=d['MAX_COLUMN_COUNT']-0x1),_0x32ac19;}function $t(_0x1cc0df,_0x1e0759){return[new h['WorkbookEditablePermission'](_0x1cc0df),new h['WorksheetEditPermission'](_0x1cc0df,_0x1e0759)];}function z(_0x5ce196,_0x29e0f6){return _0x5ce196['get'](d['IUniverInstanceService'])['getUnitType'](_0x29e0f6)===d['UniverInstanceType']['UNIVER_SHEET'];}function B(_0x208d78,_0x113d11,_0xd0a2fe,_0x5b839c,_0xb1f305){let _0x41c337=[];_0xb1f305['workbookTypes']?.['forEach'](_0xdd0968=>{_0x41c337['push'](new _0xdd0968(_0x113d11));}),_0xb1f305['worksheetTypes']?.['forEach'](_0x170278=>{_0x41c337['push'](new _0x170278(_0x113d11,_0xd0a2fe));});let _0xf9e953=_0x5b839c['map'](_0x31adf4=>Qt({..._0x31adf4})),_0x38fcea=_0x208d78['get'](h['RangeProtectionRuleModel'])['getSubunitRuleList'](_0x113d11,_0xd0a2fe)['filter'](_0x1e1556=>_0x1e1556['ranges']['some'](_0x163a55=>_0xf9e953['some'](_0x155529=>d['Rectangle']['intersects'](_0x163a55,_0x155529))));return _0xb1f305['rangeTypes']?.['forEach'](_0x4e66e2=>{_0x38fcea['forEach'](_0x4467ce=>{_0x41c337['push'](new _0x4e66e2(_0x113d11,_0xd0a2fe,_0x4467ce['permissionId']));});}),_0x41c337;}function V(_0x5ad995,_0xd30d9c){return _0xd30d9c['map'](_0x5a9c24=>new _0x5a9c24(_0x5ad995));}var en=[{'id':g['AddConditionalRuleMutation']['id'],'handle'(_0x370736,_0x5e4b89){let {params:_0x1a2174}=_0x5e4b89;return B(_0x370736,_0x1a2174['unitId'],_0x1a2174['subUnitId'],_0x1a2174['rule']['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':_['AddDataValidationMutation']['id'],'handle'(_0x27bfd6,_0x4a2d2b){let {unitId:_0x7a3f61,subUnitId:_0x265859}=_0x4a2d2b['params'];if(!z(_0x27bfd6,_0x7a3f61))return[];let _0x5cff6f=[];return Array['isArray'](_0x4a2d2b['params']['rule'])?_0x4a2d2b['params']['rule']['forEach'](_0x1661a4=>{_0x5cff6f['push'](..._0x1661a4['ranges']);}):_0x5cff6f['push'](..._0x4a2d2b['params']['rule']['ranges']),B(_0x27bfd6,_0x7a3f61,_0x265859,_0x5cff6f,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['AddRangeProtectionMutation']['id'],'handle'(_0x512255,_0x2b4a0d){let {params:_0x558581}=_0x2b4a0d,{unitId:_0x53fba1}=_0x558581;return[new h['WorkbookCreateProtectPermission'](_0x53fba1)];}},{'id':h['AddWorksheetMergeMutation']['id'],'handle'(_0xe4943c,_0x466d12){let {params:_0x364bda}=_0x466d12;return B(_0xe4943c,_0x364bda['unitId'],_0x364bda['subUnitId'],_0x364bda['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission'],h['WorksheetSetCellValuePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':g['DeleteConditionalRuleMutation']['id'],'handle'(_0x4db456,_0x31a8e5){let {params:_0x1454b4}=_0x31a8e5,_0x410ab1=_0x4db456['get'](g['ConditionalFormattingRuleModel'])['getRule'](_0x1454b4['unitId'],_0x1454b4['subUnitId'],_0x1454b4['cfId']);return _0x410ab1?B(_0x4db456,_0x1454b4['unitId'],_0x1454b4['subUnitId'],_0x410ab1['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]}):[];}},{'id':h['DeleteRangeProtectionMutation']['id'],'handle'(_0x2fb78b,_0x282b74){let {params:_0x214b04}=_0x282b74,{unitId:_0x30b47f,subUnitId:_0x2f4999,ruleIds:_0x188227}=_0x214b04,_0x4e7d4f=_0x2fb78b['get'](h['RangeProtectionRuleModel']),_0xf89742=[];for(let _0xf0535b of _0x188227){let _0x5b6187=_0x4e7d4f['getRule'](_0x30b47f,_0x2f4999,_0xf0535b);if(!_0x5b6187)return!0x1;_0xf89742['push'](new h['RangeProtectionPermissionDeleteProtectionPoint'](_0x30b47f,_0x2f4999,_0x5b6187['permissionId']));}return _0xf89742;}},{'id':h['DeleteWorksheetProtectionMutation']['id'],'handle'(_0x499749,_0x9994f3){let {params:_0x6fce51}=_0x9994f3,{unitId:_0x104c15,subUnitId:_0x1cefb5}=_0x6fce51;return[new h['WorksheetDeleteProtectionPermission'](_0x104c15,_0x1cefb5)];}},{'id':h['ToggleGridlinesMutation']['id'],'handle'(_0x1f7531,_0x478ad0){let {params:_0x4d2e55}=_0x478ad0;return[new h['WorkbookEditablePermission'](_0x4d2e55['unitId']),new h['WorksheetEditPermission'](_0x4d2e55['unitId'],_0x4d2e55['subUnitId'])];}},{'id':h['InsertColMutation']['id'],'handle'(_0x4ed6c7,_0x2b1502){let {params:_0x4fefcb}=_0x2b1502,_0x4bb64a={..._0x4fefcb['range']};return _0x4bb64a['rangeType']=d['RANGE_TYPE']['COLUMN'],B(_0x4ed6c7,_0x4fefcb['unitId'],_0x4fefcb['subUnitId'],[_0x4bb64a],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetInsertColumnPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['InsertRowMutation']['id'],'handle'(_0x5d60e4,_0x16b00c){let {params:_0x781be1}=_0x16b00c,_0x44d74c={..._0x781be1['range']};return _0x44d74c['rangeType']=d['RANGE_TYPE']['ROW'],B(_0x5d60e4,_0x781be1['unitId'],_0x781be1['subUnitId'],[_0x44d74c],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetInsertRowPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['InsertSheetMutation']['id'],'handle'(_0xf5eabf,_0x5392ca){let {params:_0x58d44b}=_0x5392ca;return V(_0x58d44b['unitId'],[h['WorkbookCreateSheetPermission']]);}},{'id':h['MoveColsMutation']['id'],'handle'(_0x43f713,_0x4f20ae){let {params:_0x32c6b3}=_0x4f20ae,_0x1ec14a={..._0x32c6b3['sourceRange']};_0x1ec14a['rangeType']=d['RANGE_TYPE']['COLUMN'];let _0x2980ab={..._0x32c6b3['targetRange']};return _0x2980ab['rangeType']=d['RANGE_TYPE']['COLUMN'],B(_0x43f713,_0x32c6b3['unitId'],_0x32c6b3['subUnitId'],[_0x1ec14a,_0x2980ab],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':g['MoveConditionalRuleMutation']['id'],'handle'(_0x31dcfb,_0x30a40c){let {params:_0x17ce36}=_0x30a40c;return $t(_0x17ce36['unitId'],_0x17ce36['subUnitId']);}},{'id':h['MoveRangeMutation']['id'],'handle'(_0x2ef84a,_0x18dbcd){let {params:_0xca4072}=_0x18dbcd,_0x182312=new d['ObjectMatrix'](_0xca4072['from']['value'])['getDataRange'](),_0x309f67=new d['ObjectMatrix'](_0xca4072['to']['value'])['getDataRange']();return B(_0x2ef84a,_0xca4072['unitId'],_0xca4072['from']['subUnitId'],[_0x182312,_0x309f67],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['MoveRowsMutation']['id'],'handle'(_0x34dc3b,_0x55b5bc){let {params:_0x1ab81e}=_0x55b5bc,_0x1257f8={..._0x1ab81e['sourceRange']};_0x1257f8['rangeType']=d['RANGE_TYPE']['ROW'];let _0x4d15ec={..._0x1ab81e['targetRange']};return _0x4d15ec['rangeType']=d['RANGE_TYPE']['ROW'],B(_0x34dc3b,_0x1ab81e['unitId'],_0x1ab81e['subUnitId'],[_0x1257f8,_0x4d15ec],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveColMutation']['id'],'handle'(_0x1cc97a,_0xddaa0c){let {params:_0x44f634}=_0xddaa0c,_0x133501={..._0x44f634['range']};return _0x133501['rangeType']=d['RANGE_TYPE']['COLUMN'],B(_0x1cc97a,_0x44f634['unitId'],_0x44f634['subUnitId'],[_0x133501],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetDeleteColumnPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':_['RemoveDataValidationMutation']['id'],'handle'(_0x4e50f1,_0x23883c){let {unitId:_0xb81d2a,subUnitId:_0x5948bb,ruleId:_0xc65509}=_0x23883c['params'];if(!z(_0x4e50f1,_0xb81d2a))return[];let _0x322664=_0x4e50f1['get'](_['DataValidationModel']),_0x44fdaf=(Array['isArray'](_0xc65509)?_0xc65509:[_0xc65509])['map'](_0x118bd6=>_0x322664['getRuleById'](_0xb81d2a,_0x5948bb,_0x118bd6)),_0x20b963=[];return _0x44fdaf['forEach'](_0x1af1a5=>{_0x1af1a5?.['ranges']&&_0x20b963['push'](..._0x1af1a5['ranges']);}),B(_0x4e50f1,_0xb81d2a,_0x5948bb,_0x20b963,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveNumfmtMutation']['id'],'handle'(_0x3ec47c,_0x819d9b){let {params:_0x134b1d}=_0x819d9b,{ranges:_0x121a25}=_0x134b1d;return B(_0x3ec47c,_0x134b1d['unitId'],_0x134b1d['subUnitId'],_0x121a25,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveRowMutation']['id'],'handle'(_0xd3c7cb,_0x5361d0){let {params:_0x285ad9}=_0x5361d0,_0xac96d4={..._0x285ad9['range']};return _0xac96d4['rangeType']=d['RANGE_TYPE']['ROW'],B(_0xd3c7cb,_0x285ad9['unitId'],_0x285ad9['subUnitId'],[_0xac96d4],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetDeleteRowPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['RemoveSheetMutation']['id'],'handle'(_0x57ea6b,_0x25c2a9){let {params:_0x4ccd5b}=_0x25c2a9;return V(_0x4ccd5b['unitId'],[h['WorkbookDeleteSheetPermission']]);}},{'id':v['RemoveSheetsFilterMutation']['id'],'handle'(_0x24b4c8,_0x2f1a02){let {params:_0x250a13}=_0x2f1a02;return B(_0x24b4c8,_0x250a13['unitId'],_0x250a13['subUnitId'],[],{'worksheetTypes':[h['WorksheetViewPermission']],'rangeTypes':[h['RangeProtectionPermissionViewPoint']]});}},{'id':h['RemoveWorksheetMergeMutation']['id'],'handle'(_0x2e8976,_0x1fe23d){let {params:_0x710c3a}=_0x1fe23d;return B(_0x2e8976,_0x710c3a['unitId'],_0x710c3a['subUnitId'],_0x710c3a['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission'],h['WorksheetSetCellValuePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['ReorderRangeMutation']['id'],'handle'(_0x3d851c,_0x415376){let {params:_0x2a9927}=_0x415376,{range:_0x2601fd}=_0x2a9927;return B(_0x3d851c,_0x2a9927['unitId'],_0x2a9927['subUnitId'],[_0x2601fd],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetSortPermission'],h['WorksheetEditPermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['SetWorksheetColWidthMutation']['id'],'handle'(_0x5dfb35,_0x58d906){let {params:_0x37c6d9}=_0x58d906,_0x1612f4=[..._0x37c6d9['ranges']]['map'](_0x216f30=>{let _0x20542f={..._0x216f30};return _0x20542f['rangeType']=d['RANGE_TYPE']['COLUMN'],_0x20542f;});return B(_0x5dfb35,_0x37c6d9['unitId'],_0x37c6d9['subUnitId'],_0x1612f4,{'worksheetTypes':[h['WorksheetSetColumnStylePermission']]});}},{'id':g['SetConditionalRuleMutation']['id'],'handle'(_0x2916a6,_0x47a1d7){let {params:_0x20a031}=_0x47a1d7,_0x8483c4=_0x2916a6['get'](g['ConditionalFormattingRuleModel'])['getRule'](_0x20a031['unitId'],_0x20a031['subUnitId'],_0x20a031['cfId']||_0x20a031['rule']['cfId']);return[..._0x8483c4?B(_0x2916a6,_0x20a031['unitId'],_0x20a031['subUnitId'],_0x8483c4['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]}):[],...B(_0x2916a6,_0x20a031['unitId'],_0x20a031['subUnitId'],_0x20a031['rule']['ranges'],{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]})];}},{'id':h['SetNumfmtMutation']['id'],'handle'(_0x450f40,_0xf2c7e9){let {params:_0x35ebd6}=_0xf2c7e9,{values:_0x356c98}=_0x35ebd6,_0x150864=[];return Object['keys'](_0x356c98)['forEach'](_0x4d819f=>{let _0x27b48f=_0x356c98[_0x4d819f];_0x150864['push'](..._0x27b48f['ranges']);}),B(_0x450f40,_0x35ebd6['unitId'],_0x35ebd6['subUnitId'],_0x150864,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}},{'id':h['SetRangeProtectionMutation']['id'],'handle'(_0x56a8ef,_0x3215b8){let {params:_0x478b6e}=_0x3215b8,{unitId:_0x5b03ed,subUnitId:_0x211931,ruleId:_0x101b4c}=_0x478b6e,_0xfa45df=_0x56a8ef['get'](h['RangeProtectionRuleModel'])['getRule'](_0x5b03ed,_0x211931,_0x101b4c);return _0xfa45df?[new h['RangeProtectionPermissionManageCollaPoint'](_0x5b03ed,_0x211931,_0xfa45df['permissionId'])]:[];}},{'id':h['SetRangeValuesMutation']['id'],'handle'(_0x5250a4,_0xff3575){let {params:_0x41b498}=_0xff3575,_0x3c08d1=new d['ObjectMatrix'](_0x41b498['cellValue']),_0x396ded=[new h['WorkbookEditablePermission'](_0x41b498['unitId']),new h['WorksheetEditPermission'](_0x41b498['unitId'],_0x41b498['subUnitId'])],_0xe4a4ab=_0x5250a4['get'](h['RangeProtectionRuleModel'])['getSubunitRuleList'](_0x41b498['unitId'],_0x41b498['subUnitId']);return _0x3c08d1['forValue']((_0x50a7c6,_0x4de2b4)=>{_0xe4a4ab['filter'](_0x2b3b74=>_0x2b3b74['ranges']['some'](_0x526fb0=>_0x50a7c6>=_0x526fb0['startRow']&&_0x50a7c6<=_0x526fb0['endRow']&&_0x4de2b4>=_0x526fb0['startColumn']&&_0x4de2b4<=_0x526fb0['endColumn']))['forEach'](_0x2ffa45=>{_0x396ded['push'](new h['RangeProtectionPermissionEditPoint'](_0x41b498['unitId'],_0x41b498['subUnitId'],_0x2ffa45['permissionId']));});}),_0x396ded;}},{'id':h['SetWorksheetRowAutoHeightMutation']['id'],'handle'(_0x24b4dc,_0x1cde85){let {params:_0x496473}=_0x1cde85,_0x3b97c6=_0x496473['rowsAutoHeightInfo']['map'](_0x3d2241=>{let _0x317b70={'startColumn':0x0,'endColumn':0x0,'startRow':_0x3d2241['row'],'endRow':_0x3d2241['row']};return _0x317b70['rangeType']=d['RANGE_TYPE']['ROW'],_0x317b70;});return B(_0x24b4dc,_0x496473['unitId'],_0x496473['subUnitId'],_0x3b97c6,{'worksheetTypes':[h['WorksheetSetRowStylePermission']]});}},{'id':h['SetWorksheetRowHeightMutation']['id'],'handle'(_0x1246df,_0x3e04ec){let {params:_0x132dc3}=_0x3e04ec,_0x49f01e=[..._0x132dc3['ranges']]['map'](_0x5e169c=>{let _0x10c73c={..._0x5e169c};return _0x10c73c['rangeType']=d['RANGE_TYPE']['ROW'],_0x10c73c;});return B(_0x1246df,_0x132dc3['unitId'],_0x132dc3['subUnitId'],_0x49f01e,{'worksheetTypes':[h['WorksheetSetRowStylePermission']]});}},{'id':h['SetWorksheetHideMutation']['id'],'handle'(_0x229f46,_0x298823){let {params:_0x465a04}=_0x298823;return V(_0x465a04['unitId'],[h['WorkbookHideSheetPermission']]);}},{'id':h['SetWorksheetNameMutation']['id'],'handle'(_0x1bf853,_0x26dbe0){let {params:_0x425f9a}=_0x26dbe0;return V(_0x425f9a['unitId'],[h['WorkbookRenameSheetPermission']]);}},{'id':h['SetWorksheetOrderMutation']['id'],'handle'(_0x445d5d,_0x28f26b){let {params:_0x18c945}=_0x28f26b;return V(_0x18c945['unitId'],[h['WorkbookMoveSheetPermission']]);}},{'id':v['SetSheetsFilterRangeMutation']['id'],'handle'(_0x41fafa,_0x51097a){let {params:_0x10a916}=_0x51097a;return B(_0x41fafa,_0x10a916['unitId'],_0x10a916['subUnitId'],[_0x10a916['range']],{'worksheetTypes':[h['WorksheetViewPermission']],'rangeTypes':[h['RangeProtectionPermissionViewPoint']]});}},{'id':h['SetWorksheetProtectionMutation']['id'],'handle'(_0x15f306,_0x57246e){let {params:_0x3d9df4}=_0x57246e,{unitId:_0x48d383,subUnitId:_0x430f35}=_0x3d9df4;return[new h['WorksheetManageCollaboratorPermission'](_0x48d383,_0x430f35)];}},{'id':_['UpdateDataValidationMutation']['id'],'handle'(_0x3f146e,_0x1930fb){let {unitId:_0x47fc77,subUnitId:_0x61e5cc,ruleId:_0x1ec7ca,payload:_0x2a530f}=_0x1930fb['params'];if(!z(_0x3f146e,_0x47fc77))return[];let _0x4fdb5c=_0x3f146e['get'](_['DataValidationModel']),_0x2904e6=(Array['isArray'](_0x1ec7ca)?_0x1ec7ca:[_0x1ec7ca])['map'](_0xd344a0=>_0x4fdb5c['getRuleById'](_0x47fc77,_0x61e5cc,_0xd344a0)),_0x3efe1f=[];return _0x2904e6['forEach'](_0x4628e7=>{_0x4628e7?.['ranges']&&_0x3efe1f['push'](..._0x4628e7['ranges']);}),_0x2a530f['type']===_['UpdateRuleType']['RANGE']&&_0x3efe1f['push'](..._0x2a530f['payload']),B(_0x3f146e,_0x47fc77,_0x61e5cc,_0x3efe1f,{'workbookTypes':[h['WorkbookEditablePermission']],'worksheetTypes':[h['WorksheetEditPermission'],h['WorksheetSetCellStylePermission']],'rangeTypes':[h['RangeProtectionPermissionEditPoint']]});}}];function tn(_0xcd9e8b,_0x2a0d00,_0x59663e){let _0x36b9fd=_0x59663e;if(_0x36b9fd['unitId']!==_0x2a0d00)throw H('Permission\x20point\x20identifies\x20another\x20Unit');switch(_0x36b9fd['type']){case c['UnitObject']['Workbook']:return{'objectID':_0x2a0d00,'objectType':_0x36b9fd['type'],'action':_0x36b9fd['subType']};case c['UnitObject']['Worksheet']:return nn(_0xcd9e8b,_0x2a0d00,_0x36b9fd);case c['UnitObject']['SelectRange']:if(!_0x36b9fd['permissionId'])throw H('Range\x20permission\x20point\x20has\x20no\x20object\x20ID');return{'objectID':_0x36b9fd['permissionId'],'objectType':_0x36b9fd['type'],'action':_0x36b9fd['subType']};default:throw H('Unsupported\x20Sheet\x20permission\x20point\x20type');}}function nn(_0x3d345a,_0x24cfee,_0x56a12b){if(!_0x56a12b['subUnitId'])throw H('Worksheet\x20permission\x20point\x20has\x20no\x20subUnit\x20ID');let _0x3edd76;if(h['baseProtectionActions']['includes'](_0x56a12b['subType'])?_0x3edd76=_0x3d345a['get'](h['WorksheetProtectionRuleModel'])['getRule'](_0x24cfee,_0x56a12b['subUnitId'])?.['permissionId']:h['defaultWorksheetPermissionPoint']['includes'](_0x56a12b['subType'])&&(_0x3edd76=_0x3d345a['get'](h['WorksheetProtectionPointModel'])['getRule'](_0x24cfee,_0x56a12b['subUnitId'])?.['permissionId']),_0x3edd76)return{'objectID':_0x3edd76,'objectType':c['UnitObject']['Worksheet'],'action':_0x56a12b['subType']};}function H(_0x2a8d4f){return new C('INVALID_REQUEST',_0x2a8d4f);}var rn=new Map(en['map'](_0x3c57d4=>[_0x3c57d4['id'],_0x3c57d4]));function an(_0x47c8e6,_0x4ef9fb,_0x35e955){let _0x98e1b=rn['get'](_0x35e955['id']);if(!_0x98e1b)return[];let _0xdfc063=_0x98e1b['handle'](_0x47c8e6,_0x35e955);if(_0xdfc063===!0x1)throw new C('INVALID_REQUEST','Mutation\x20permission\x20analysis\x20failed\x20for\x20'+_0x35e955['id']);let _0x239d41=[];for(let _0x2084f9 of _0xdfc063){let _0x1f3330=tn(_0x47c8e6,_0x4ef9fb,_0x2084f9);_0x1f3330&&_0x239d41['push']({'unitID':_0x4ef9fb,..._0x1f3330});}return _0x239d41;}var on={'name':'SLIDE_OBJECT_PERMISSION_PLUGIN','business':d['UniverInstanceType']['UNIVER_SLIDE'],'objectTypes':new Set([c['UnitObject']['SlidePage'],c['UnitObject']['SlideElement'],c['UnitObject']['SlideMaster']]),'label':'Slide'};function sn(_0x28a1a1,_0x44eea9){return A(_0x28a1a1,_0x44eea9,on);}var cn=class{['model'];['resourceService'];['targets']=new Set();constructor(_0x29d473,_0x501fc8){this['model']=_0x29d473,this['resourceService']=_0x501fc8;}['collect'](_0x292ec3){return this['_checkChartMutation'](_0x292ec3),this['targets'];}['add'](_0x1321a1){for(let _0x49024e of _0x1321a1)this['targets']['add'](_0x49024e);}['_checkChartMutation'](_0x152e7b){switch(_0x152e7b['id']){case b['RemoveSlideChartDataSourceMutation']['id']:{let _0x1fc3ce=_0x152e7b['params'];return _0x1fc3ce&&this['_assertDataSource'](_0x1fc3ce['unitId'],_0x1fc3ce['dataSourceId']),!0x0;}case b['RemoveSlideChartSnapshotMutation']['id']:{let _0x511f8a=_0x152e7b['params'];return _0x511f8a&&this['_assertChart'](_0x511f8a['unitId'],_0x511f8a['chartId']),!0x0;}case b['SetSlideChartDataSourceMutation']['id']:{let _0x2d5e6c=_0x152e7b['params'];return _0x2d5e6c&&this['_assertDataSource'](_0x2d5e6c['unitId'],_0x2d5e6c['dataSource']['id']),!0x0;}case b['SetSlideChartSnapshotMutation']['id']:{let _0x5c1a23=_0x152e7b['params'];return _0x5c1a23&&this['_assertChart'](_0x5c1a23['unitId'],_0x5c1a23['chart']['id']),!0x0;}default:return!0x1;}}['_getSlideModel'](_0x27f3dd){return _0x27f3dd===this['model']['getUnitId']()?this['model']:void 0x0;}['_assertDataSource'](_0x442e0a,_0x43be47){let _0x35e35a=this['resourceService']['getChartIdsByDataSource'](_0x442e0a,_0x43be47);this['_assertCharts'](_0x442e0a,_0x35e35a);}['_assertChart'](_0x294735,_0x2b2bdb){this['_assertCharts'](_0x294735,[_0x2b2bdb]);}['_assertCharts'](_0x2ec32e,_0x4fb944){let _0x4c378a=this['_getSlideModel'](_0x2ec32e);if(!_0x4c378a)return;let _0x3fb300=new Set(_0x4fb944),_0x34a673=(0x0,x['resolveMatchingSlideElementPermissionObjectIds'])(_0x4c378a,_0x51aed8=>_0x51aed8['type']===x['PageElementTypeEnum']['Chart']&&_0x3fb300['has'](_0x51aed8['chartId']));this['add'](_0x34a673);}['_assertPage'](_0x408f63,_0x2acbd5,_0x3aed8b){if(_0x3aed8b){this['_assertElement'](_0x408f63,_0x2acbd5,_0x3aed8b);return;}let _0x5d520b=this['_getSlideModel'](_0x408f63);if(!_0x5d520b)return;let _0x1acb8d=(0x0,x['getSlidePageType'])(_0x5d520b,_0x2acbd5),_0x27eb81=[];_0x1acb8d===x['PageTypeEnum']['Slide']?_0x27eb81['push']((0x0,x['getSlidePagePermissionObjectId'])(_0x2acbd5)):(_0x1acb8d===x['PageTypeEnum']['Master']||_0x1acb8d===x['PageTypeEnum']['Layout'])&&_0x27eb81['push'](x['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']),this['add'](_0x27eb81);}['_assertElement'](_0x3332b8,_0x4e0f1d,_0x58b666){let _0x5214ee=this['_getSlideModel'](_0x3332b8);if(!_0x5214ee)return;let _0xad3d1a=(0x0,x['getSlidePageType'])(_0x5214ee,_0x4e0f1d)??x['PageTypeEnum']['Slide'],_0x58e40e=new Set();(0x0,x['addSlideElementPermissionObjectIds'])(_0x5214ee,_0x4e0f1d,_0xad3d1a,new Set([_0x58b666]),_0x58e40e),this['add'](_0x58e40e);}},ln=class{['model'];['targets']=new Set();constructor(_0xa6e568){this['model']=_0xa6e568;}['collect'](_0x560888){return this['_checkPresentationMutation'](_0x560888),this['_checkPageMutation'](_0x560888),this['_checkElementMutation'](_0x560888),this['_checkDrawingMutation'](_0x560888),this['targets'];}['add'](_0x2813cc){for(let _0x3a974c of _0x2813cc)this['targets']['add'](_0x3a974c);}['_checkPresentationMutation'](_0x14080b){switch(_0x14080b['id']){case x['EnsureSlideMasterPageMutation']['id']:{let _0xfbdcf6=_0x14080b['params'];return _0xfbdcf6&&this['_assertPageSnapshot'](_0xfbdcf6['unitId'],_0xfbdcf6['masterPage']),!0x0;}case'slide.mutation.set-name':{let _0x4966b1=_0x14080b['params'];return _0x4966b1&&this['_assertUnit'](_0x4966b1['unitId']),!0x0;}case x['SetSlidePageSizeMutation']['id']:{let _0x527d08=_0x14080b['params'];return _0x527d08&&this['_assertOptionalPage'](_0x527d08['unitId'],_0x527d08['pageId']),!0x0;}case x['SetPresentationBackgroundGraphicsMutation']['id']:{let _0x335066=_0x14080b['params'];return _0x335066&&this['_assertMasterView'](_0x335066['unitId']),!0x0;}case x['SetSlideTransitionMutation']['id']:{let _0x96b17c=_0x14080b['params'];return _0x96b17c&&this['_assertPages'](_0x96b17c['unitId'],Object['keys'](_0x96b17c['slideTransitionRefs']??{})),!0x0;}default:return!0x1;}}['_checkPageMutation'](_0x1d5504){switch(_0x1d5504['id']){case x['AddSlidePageMutation']['id']:{let _0x2690b2=_0x1d5504['params'];return _0x2690b2&&this['_assertPageSnapshot'](_0x2690b2['unitId'],_0x2690b2['slide']),!0x0;}case x['MoveSlidePageMutation']['id']:{let _0x120f32=_0x1d5504['params'];return _0x120f32&&this['_assertPage'](_0x120f32['unitId'],_0x120f32['subUnitId']),!0x0;}case x['RemoveSlidePageMutation']['id']:{let _0x5b6667=_0x1d5504['params'];return _0x5b6667&&this['_assertPageWithElements'](_0x5b6667['unitId'],_0x5b6667['subUnitId']),!0x0;}case'slide.mutation.set-slide-placeholder-suppression':{let _0xa19f8b=_0x1d5504['params'];return _0xa19f8b&&this['_assertPage'](_0xa19f8b['unitId'],_0xa19f8b['subUnitId']),!0x0;}case x['SetSlideSpeakerNotesMutation']['id']:{let _0x150ebd=_0x1d5504['params'];return _0x150ebd&&this['_assertPage'](_0x150ebd['unitId'],_0x150ebd['subUnitId']),!0x0;}case x['UpdateSlidePageBackgroundMutation']['id']:{let _0x1fc399=_0x1d5504['params'];return _0x1fc399&&this['_assertPage'](_0x1fc399['unitId'],_0x1fc399['pageId']),!0x0;}default:return!0x1;}}['_checkElementMutation'](_0xb76f28){switch(_0xb76f28['id']){case x['AddSlideElementMutation']['id']:{let _0x187fa6=_0xb76f28['params'];return _0x187fa6&&this['_assertElements'](_0x187fa6['unitId'],_0x187fa6['subUnitId'],[_0x187fa6['element']['id']],_0x187fa6['sourcePageType']),!0x0;}case x['InsertDrawingObjectMutation']['id']:{let _0x156134=_0xb76f28['params'];return _0x156134?.['drawings']['forEach'](_0x31f120=>this['_assertElements'](_0x156134['unitId'],_0x156134['subUnitId'],[_0x31f120['drawingId']],_0x31f120['sourcePageType'])),!0x0;}case x['RemoveSlideElementMutation']['id']:{let _0x9671e6=_0xb76f28['params'];return _0x9671e6&&this['_assertElements'](_0x9671e6['unitId'],_0x9671e6['subUnitId'],[_0x9671e6['drawingId']]),!0x0;}case x['UpdateSlideElementMutation']['id']:{let _0x2b410f=_0xb76f28['params'];return _0x2b410f&&!_0x2b410f['formulaLastValueGuard']&&this['_assertElements'](_0x2b410f['unitId'],_0x2b410f['subUnitId'],[_0x2b410f['drawingId']]),!0x0;}default:return!0x1;}}['_checkDrawingMutation'](_0x26acde){switch(_0x26acde['id']){case x['SetSlideDrawingApplyMutation']['id']:{let _0x3c4d3e=_0x26acde['params'];return _0x3c4d3e&&this['_assertElements'](_0x3c4d3e['unitId'],_0x3c4d3e['subUnitId'],_0x3c4d3e['objects']['map'](_0x57ee63=>_0x57ee63['drawingId'])),!0x0;}case x['SetSlideElementOrderMutation']['id']:{let _0x15fd64=_0x26acde['params'];return _0x15fd64&&this['_assertElements'](_0x15fd64['unitId'],_0x15fd64['subUnitId'],_0x15fd64['drawingIds']),!0x0;}case x['SetSlideGroupMutation']['id']:{let _0x54b59f=_0x26acde['params'];return _0x54b59f&&this['_assertElements'](_0x54b59f['unitId'],_0x54b59f['subUnitId'],_0x54b59f['drawingIds']),!0x0;}case x['CancelSlideGroupMutation']['id']:{let _0x3dccf1=_0x26acde['params'];return _0x3dccf1&&this['_assertElements'](_0x3dccf1['unitId'],_0x3dccf1['subUnitId'],_0x3dccf1['drawingIds']),!0x0;}default:return!0x1;}}['_getSlideModel'](_0x432f85){return _0x432f85===this['model']['getUnitId']()?this['model']:void 0x0;}['_assertUnit'](_0x1ef81c){this['_getSlideModel'](_0x1ef81c)&&this['add']([]);}['_assertOptionalPage'](_0x59ac21,_0x19020f){if(_0x19020f){this['_assertPage'](_0x59ac21,_0x19020f);return;}this['_assertUnit'](_0x59ac21);}['_assertPage'](_0x4b9a1a,_0x24a924,_0xc5040d){let _0x27fb22=this['_getSlideModel'](_0x4b9a1a);if(!_0x27fb22)return;let _0x5924a4=_0xc5040d??(0x0,x['getSlidePageType'])(_0x27fb22,_0x24a924),_0x6d3402=new Set();this['_addPageTarget'](_0x24a924,_0x5924a4,_0x6d3402),this['add'](_0x6d3402);}['_assertPages'](_0x2c3c3e,_0x34be48){let _0x40a19e=this['_getSlideModel'](_0x2c3c3e);if(!_0x40a19e)return;let _0x2769fa=new Set();_0x34be48['forEach'](_0x43caf4=>this['_addPageTarget'](_0x43caf4,(0x0,x['getSlidePageType'])(_0x40a19e,_0x43caf4),_0x2769fa)),this['add'](_0x2769fa);}['_assertPageWithElements'](_0x28c97d,_0x3468fe){let _0x1f29e2=this['_getSlideModel'](_0x28c97d);if(!_0x1f29e2)return;let _0xe21b66=_0x1f29e2['getSnapshot']()['slides'][_0x3468fe],_0x25d2fa=new Set();this['_addPageTarget'](_0x3468fe,(0x0,x['getSlidePageType'])(_0x1f29e2,_0x3468fe),_0x25d2fa),(0x0,x['addSlideElementPermissionObjectIds'])(_0x1f29e2,_0x3468fe,x['PageTypeEnum']['Slide'],new Set(Object['keys'](_0xe21b66?.['elements']??{})),_0x25d2fa),this['add'](_0x25d2fa);}['_assertElements'](_0x3f6305,_0x1d7194,_0x5ea4e6,_0xd4c040){let _0x46b5a3=this['_getSlideModel'](_0x3f6305);if(!_0x46b5a3)return;let _0x21bbec=_0xd4c040??(0x0,x['getSlidePageType'])(_0x46b5a3,_0x1d7194)??x['PageTypeEnum']['Slide'],_0x3393cd=new Set();(0x0,x['addSlideElementPermissionObjectIds'])(_0x46b5a3,_0x1d7194,_0x21bbec,new Set(_0x5ea4e6),_0x3393cd),this['add'](_0x3393cd);}['_assertMasterView'](_0x565376){this['_getSlideModel'](_0x565376)&&this['add']([x['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']]);}['_assertPageSnapshot'](_0x52bb24,_0x3caf84){if(!this['_getSlideModel'](_0x52bb24))return;let _0x4919a0=new Set();this['_addPageTarget'](_0x3caf84['id'],_0x3caf84['pageType'],_0x4919a0),Object['keys'](_0x3caf84['elements'])['forEach'](_0x2be182=>{_0x4919a0['add']((0x0,x['getSlideElementPermissionObjectId'])(_0x3caf84['pageType'],_0x3caf84['id'],_0x2be182));}),this['add'](_0x4919a0);}['_addPageTarget'](_0x32e41d,_0x29c5d4,_0x2bda2a){_0x29c5d4===x['PageTypeEnum']['Master']||_0x29c5d4===x['PageTypeEnum']['Layout']?_0x2bda2a['add'](x['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']):_0x29c5d4===x['PageTypeEnum']['Slide']&&_0x2bda2a['add']((0x0,x['getSlidePagePermissionObjectId'])(_0x32e41d));}},un=class{['model'];['targets']=new Set();constructor(_0x473ca4){this['model']=_0x473ca4;}['collect'](_0x235aea){return this['_checkTableMutation'](_0x235aea),this['targets'];}['add'](_0x1f6812){for(let _0x1ed419 of _0x1f6812)this['targets']['add'](_0x1ed419);}['_checkTableMutation'](_0x51417a){switch(_0x51417a['id']){case S['RemoveSlideTableMutation']['id']:{let _0xf2c2c6=_0x51417a['params'];return _0xf2c2c6&&this['_assertTable'](_0xf2c2c6['unitId'],_0xf2c2c6['tableId']),!0x0;}case S['SetSlideTableMutation']['id']:{let _0x1ba680=_0x51417a['params'];return _0x1ba680&&this['_assertTable'](_0x1ba680['unitId'],_0x1ba680['table']['id']),!0x0;}default:return!0x1;}}['_getSlideModel'](_0x33ad2a){return _0x33ad2a===this['model']['getUnitId']()?this['model']:void 0x0;}['_assertTable'](_0x575c38,_0x1d8f79,_0x25c8cd,_0x446d34){if(_0x25c8cd&&_0x446d34){this['_assertElement'](_0x575c38,_0x25c8cd,_0x446d34);return;}let _0x54ce4d=this['_getSlideModel'](_0x575c38);if(!_0x54ce4d)return;let _0x14fa4a=(0x0,x['resolveMatchingSlideElementPermissionObjectIds'])(_0x54ce4d,_0x186ec0=>_0x186ec0['type']===x['PageElementTypeEnum']['Table']&&_0x186ec0['tableId']===_0x1d8f79);this['add'](_0x14fa4a);}['_assertPage'](_0x4c17f4,_0x3eb21a,_0x46270a){if(_0x46270a){this['_assertElement'](_0x4c17f4,_0x3eb21a,_0x46270a);return;}let _0x588375=this['_getSlideModel'](_0x4c17f4);if(!_0x588375)return;let _0x3e7f44=(0x0,x['getSlidePageType'])(_0x588375,_0x3eb21a),_0x3bd716=[];_0x3e7f44===x['PageTypeEnum']['Slide']?_0x3bd716['push']((0x0,x['getSlidePagePermissionObjectId'])(_0x3eb21a)):(_0x3e7f44===x['PageTypeEnum']['Master']||_0x3e7f44===x['PageTypeEnum']['Layout'])&&_0x3bd716['push'](x['SLIDE_MASTER_VIEW_PERMISSION_OBJECT_ID']),this['add'](_0x3bd716);}['_assertElement'](_0x38bf26,_0x129479,_0x44571b){let _0x3e8575=this['_getSlideModel'](_0x38bf26);if(!_0x3e8575)return;let _0x4b4c29=(0x0,x['getSlidePageType'])(_0x3e8575,_0x129479)??x['PageTypeEnum']['Slide'],_0x561bf9=new Set();(0x0,x['addSlideElementPermissionObjectIds'])(_0x3e8575,_0x129479,_0x4b4c29,new Set([_0x44571b]),_0x561bf9),this['add'](_0x561bf9);}},dn=new Set([y['AddCommentMutation']['id'],y['DeleteCommentMutation']['id'],y['ResolveCommentMutation']['id'],y['UpdateCommentMutation']['id'],y['UpdateCommentRefMutation']['id']]);function fn(_0x49d4e5,_0x44cfc9,_0x1e53c0){if(dn['has'](_0x1e53c0['id']))return[{'unitID':_0x44cfc9,'objectID':_0x44cfc9,'objectType':c['UnitObject']['Slide'],'action':c['UnitAction']['Comment']}];let _0x1ddd30=_0x49d4e5['get'](d['IUniverInstanceService'])['getUnit'](_0x44cfc9,d['UniverInstanceType']['UNIVER_SLIDE']),_0x59852d=new Set([...new ln(_0x1ddd30)['collect'](_0x1e53c0),...new cn(_0x1ddd30,_0x49d4e5['get'](b['SlideChartResourceService']))['collect'](_0x1e53c0),...new un(_0x1ddd30)['collect'](_0x1e53c0)]);return _0x59852d['size']===0x0?[]:O(_0x44cfc9,_0x59852d,sn(_0x49d4e5,_0x44cfc9));}var pn={[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']},mn=class{['_handle'];['_requirements']=new Map();['_injector'];constructor(_0x435e5c,_0x2292c7){this['_handle']=_0x2292c7,this['_injector']=_0x435e5c['__getInjector']();}['collect'](_0x599600){let {unitID:_0x5df700,type:_0x1db5d3}=this['_handle'],_0x5d9850=_0x599600['params'];if(_0x5d9850?.['unitId']!==void 0x0&&_0x5d9850['unitId']!==_0x5df700)throw new C('INVALID_REQUEST','Mutation\x20identifies\x20another\x20Unit');let _0x4f4a92=pn[_0x1db5d3];if(_0x4f4a92!==void 0x0){this['_add']({'unitID':_0x5df700,'objectID':_0x5df700,'objectType':_0x4f4a92,'action':c['UnitAction']['Edit']});for(let _0x2f41bc of this['_collectUnitPermissions'](_0x599600))this['_add'](_0x2f41bc);}}['finish'](){return[...this['_requirements']['values']()];}['_collectUnitPermissions'](_0x36717a){let {unitID:_0x2b33f9,type:_0x3e61d4}=this['_handle'];switch(_0x3e61d4){case c['UniverType']['UNIVER_SHEET']:return an(this['_injector'],_0x2b33f9,_0x36717a);case c['UniverType']['UNIVER_DOC']:return Zt(this['_injector'],_0x2b33f9,_0x36717a);case c['UniverType']['UNIVER_SLIDE']:return fn(this['_injector'],_0x2b33f9,_0x36717a);case c['UniverType']['UNIVER_BOARD']:return Mt(this['_injector'],_0x2b33f9,_0x36717a);case c['UniverType']['UNIVER_BASE']:return Tt(this['_injector'],_0x2b33f9,_0x36717a);default:return[];}}['_add'](_0x335fb7){let {unitID:_0x762732,objectID:_0x1a4e4c,objectType:_0x215214,action:_0x52656d}=_0x335fb7,_0xbe1326=JSON['stringify']([_0x762732,_0x1a4e4c,_0x215214,_0x52656d]);this['_requirements']['set'](_0xbe1326,_0x335fb7);}},hn=new WeakSet();function gn(_0x5c3f66){if(!hn['has'](_0x5c3f66)){for(let _0x578974 of[_n,vn])_0x5c3f66['hasCommand'](_0x578974['id'])&&_0x5c3f66['unregisterCommand'](_0x578974['id']),_0x5c3f66['registerCommand'](_0x578974);hn['add'](_0x5c3f66);}}var _n={'id':'doc.mutation.rich-text-editing','type':d['CommandType']['MUTATION'],'handler'(_0x566339,_0x40520){let _0x58747c=_0x566339['get'](d['IUniverInstanceService'])['getUnit'](_0x40520['unitId'],d['UniverInstanceType']['UNIVER_DOC']);if(!_0x58747c)return!0x1;if(!_0x40520['actions']||d['JSONX']['isNoop'](_0x40520['actions']))return!0x0;let _0x240f8b=_0x58747c['getSnapshot'](),_0x435961=d['JSONX']['invertWithDoc'](_0x40520['actions'],_0x240f8b);_0x58747c['apply'](_0x40520['actions']);let _0x3868c3=(0x0,l['validateDocumentAfterApply'])(_0x58747c['getSnapshot']());if(!_0x3868c3['ok'])throw _0x58747c['apply'](_0x435961),Error('Invalid\x20Doc\x20mutation\x20result:\x20'+_0x3868c3['errors']['join']('\x20'));return!0x0;}},vn={'id':'doc.mutation.rename-doc','type':d['CommandType']['MUTATION'],'handler'(_0x1d503d,_0x10f34f){if(!_0x10f34f)return!0x1;let _0x21db7c=_0x1d503d['get'](d['IUniverInstanceService'])['getUnit'](_0x10f34f['unitId'],d['UniverInstanceType']['UNIVER_DOC']);return _0x21db7c?(_0x21db7c['setName'](_0x10f34f['name']),!0x0):!0x1;}},yn={'code':c['ErrorCode']['OK'],'message':''},bn=class{['_reader'];['_contexts']=new WeakMap();['_capture']=new ie['AsyncLocalStorage']();constructor(_0x31b1f3){this['_reader']=_0x31b1f3;}['createContext'](_0x55759b,_0x12928f){let _0x5454ac={};return this['_contexts']['set'](_0x5454ac,{'databaseContext':_0x55759b,..._0x12928f?{'snapshot':_0x12928f}:{}}),_0x5454ac;}async['capture'](_0x593557){let _0x46c01d={'sheetBlocks':[]};return{'result':await this['_capture']['run'](_0x46c01d,_0x593557),..._0x46c01d['snapshot']?{'snapshot':_0x46c01d['snapshot']}:{},'sheetBlocks':_0x46c01d['sheetBlocks']};}async['getUnitOnRev'](_0x1a17b7,_0x45803b){let _0x28a3a5=this['_requireBinding'](_0x1a17b7),_0x1d1a00=_0x28a3a5['snapshot']?.['unitID']===_0x45803b['unitID']&&_0x28a3a5['snapshot']['type']===_0x45803b['type']&&_0x28a3a5['snapshot']['rev']===_0x45803b['revision']?_0x28a3a5['snapshot']:await this['_database'](()=>this['_reader']['getSnapshot'](_0x28a3a5['databaseContext'],_0x45803b['unitID'],{'revision':_0x45803b['revision']}));if(!_0x1d1a00)throw W('Stored\x20Unit\x20snapshot\x20is\x20missing');if(_0x1d1a00['unitID']!==_0x45803b['unitID']||_0x1d1a00['type']!==_0x45803b['type']||!Number['isSafeInteger'](_0x1d1a00['rev'])||_0x1d1a00['rev']<0x1||_0x1d1a00['rev']>_0x45803b['revision']||!xn(_0x1d1a00))throw W('Stored\x20Unit\x20snapshot\x20is\x20invalid');let _0x2fd742=await this['_database'](()=>this['_reader']['getChangesets'](_0x28a3a5['databaseContext'],_0x45803b['unitID'],{'from':_0x1d1a00['rev'],'to':_0x45803b['revision']}));if(_0x2fd742===null)throw W('Stored\x20Unit\x20is\x20unavailable');return Sn(_0x45803b,_0x1d1a00,_0x2fd742),{'error':void 0x0,'snapshot':_0x1d1a00,'changesets':[..._0x2fd742]};}async['getSheetBlock'](_0x3d9eca,_0x116feb){let _0xba7c8a=await this['_database'](()=>this['_reader']['getSheetBlock'](this['_requireContext'](_0x3d9eca),_0x116feb['unitID'],_0x116feb['blockID']));if(!_0xba7c8a)throw W('Stored\x20Sheet\x20block\x20'+_0x116feb['blockID']+'\x20is\x20missing');return{'error':void 0x0,'block':_0xba7c8a};}['getDeserializedSheetBlock'](_0x3b9a87,_0x33e509){return this['getSheetBlock'](_0x3b9a87,_0x33e509);}async['fetchMissingChangesets'](_0x4e4710,_0xec32e0){let _0x198cb5=await this['_database'](()=>this['_reader']['getChangesets'](this['_requireContext'](_0x4e4710),_0xec32e0['unitID'],{'from':_0xec32e0['from'],..._0xec32e0['to']===0x0?{}:{'to':_0xec32e0['to']}}));if(_0x198cb5===null)throw W('Stored\x20Unit\x20is\x20unavailable');return{'error':void 0x0,'changesets':[..._0x198cb5]};}['getResourcesRequest'](_0x2d0550,_0x571ceb){return Promise['resolve']({'error':void 0x0,'resources':{}});}async['saveSnapshot'](_0x380d9f,_0x5d7979){let _0x4bd62d=this['_requireCapture']();if(!_0x5d7979['snapshot'])throw Error('SnapshotService\x20attempted\x20to\x20save\x20an\x20empty\x20snapshot');return _0x4bd62d['snapshot']=_0x5d7979['snapshot'],{'error':yn};}['updateSnapshot'](_0x13808d,_0x1e16c2){return this['saveSnapshot'](_0x13808d,_0x1e16c2);}async['saveSheetBlock'](_0x3c6f96,_0x2be506){let _0x35080f=this['_requireCapture']();if(!_0x2be506['block'])throw Error('SnapshotService\x20attempted\x20to\x20save\x20an\x20empty\x20Sheet\x20block');return _0x35080f['sheetBlocks']['push'](_0x2be506['block']),{'error':yn,'blockID':_0x2be506['block']['id']};}['saveChangeset'](_0xdc2191,_0x28fb15){return U('saveChangeset');}['copyFileMeta'](_0x1820cc,_0x104d71){return U('copyFileMeta');}['getLatestCsReqIdBySid'](_0x2ba03c,_0x7987f5){return U('getLatestCsReqIdBySid');}['_requireBinding'](_0x50a47b){let _0x385767=this['_contexts']['get'](_0x50a47b);if(!_0x385767)throw Error('Snapshot\x20operation\x20is\x20missing\x20its\x20Database\x20context');return _0x385767;}['_requireContext'](_0x433bbb){return this['_requireBinding'](_0x433bbb)['databaseContext'];}['_requireCapture'](){let _0x5cf4a3=this['_capture']['getStore']();if(!_0x5cf4a3)throw Error('Snapshot\x20save\x20was\x20called\x20outside\x20a\x20capture\x20operation');return _0x5cf4a3;}async['_database'](_0x96092d){try{return await _0x96092d();}catch(_0x2217f3){throw _0x2217f3 instanceof C?_0x2217f3:new C('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x2217f3});}}};function U(_0x3c3b2d){return Promise['reject'](Error('SnapshotAdapterBridge\x20does\x20not\x20support\x20'+_0x3c3b2d));}function W(_0x11661e){return new C('ADAPTER_FAILURE',_0x11661e,{'retryable':!0x0});}function xn(_0x50f69a){switch(_0x50f69a['type']){case c['UniverType']['UNIVER_SHEET']:case c['UniverType']['UNIVER_BASE']:return _0x50f69a['workbook']!==void 0x0;case c['UniverType']['UNIVER_DOC']:return _0x50f69a['doc']!==void 0x0;case c['UniverType']['UNIVER_SLIDE']:return _0x50f69a['slide']!==void 0x0;case c['UniverType']['UNIVER_BOARD']:return _0x50f69a['board']!==void 0x0;default:return!0x1;}}function Sn(_0x3bf1a7,_0x362e11,_0x50455c){let _0x17e4de=_0x362e11['rev']+0x1;for(let _0x1c4ba8 of _0x50455c){if(_0x1c4ba8['unitID']!==_0x3bf1a7['unitID']||_0x1c4ba8['type']!==_0x3bf1a7['type']||_0x1c4ba8['baseRev']!==_0x17e4de-0x1||_0x1c4ba8['revision']!==_0x17e4de)throw W('Stored\x20changeset\x20history\x20is\x20not\x20contiguous');_0x17e4de+=0x1;}if(_0x17e4de-0x1!==_0x3bf1a7['revision'])throw W('Stored\x20changeset\x20history\x20is\x20incomplete');}function Cn(_0x205797){_0x205797['__getInjector']()['add']([ae['IFeatureCalculationManagerService'],{'useClass':ae['FeatureCalculationManagerService']}]),_0x205797['registerPlugin'](ye['UniverProFormulaEnginePlugin'],{'notExecuteFormula':!0x0}),_0x205797['registerPlugin'](l['UniverCollaborationPlugin']),wn(_0x205797),Tn(_0x205797),En(_0x205797),Dn(_0x205797),On(_0x205797),kn(_0x205797);}function wn(_0x574324){_0x574324['registerPlugin'](y['UniverThreadCommentPlugin']),_0x574324['registerPlugin'](De['UniverThreadCommentResourcePlugin']),_0x574324['registerPlugin'](je['UniverDrawingPlugin']),_0x574324['registerPlugin'](ve['UniverEmbedPlugin']);}function Tn(_0x359c26){_0x359c26['registerPlugin'](ke['UniverDocsHyperLinkPlugin']),_0x359c26['registerPlugin'](Oe['UniverDocsDrawingPlugin']),_0x359c26['registerPlugin'](fe['UniverDocsCalloutPlugin']),_0x359c26['registerPlugin'](pe['UniverDocsChartPlugin']),_0x359c26['registerPlugin'](me['UniverDocsCodePlugin']),_0x359c26['registerPlugin'](he['UniverDocsLatexPlugin']),_0x359c26['registerPlugin'](ge['UniverDocsShapePlugin']),_0x359c26['registerPlugin'](_e['UniverDocsTablePlugin']),_0x359c26['registerPlugin'](Ae['UniverDocsThreadCommentPlugin']);}function En(_0x31fd51){_0x31fd51['registerPlugin'](h['UniverSheetsPlugin'],{'notExecuteFormula':!0x0}),_0x31fd51['registerPlugin'](g['UniverSheetsConditionalFormattingPlugin']),_0x31fd51['registerPlugin'](_['UniverDataValidationPlugin']),_0x31fd51['registerPlugin'](v['UniverSheetsFilterPlugin']),_0x31fd51['registerPlugin'](Ne['UniverSheetsHyperLinkPlugin']),_0x31fd51['registerPlugin'](Se['UniverSheetsPivotTablePlugin']),_0x31fd51['registerPlugin'](Ie['UniverSheetsTablePlugin']),_0x31fd51['registerPlugin'](xe['UniverSheetsOutlinePlugin']),_0x31fd51['registerPlugin'](Te['UniverSheetSparklinePlugin']),_0x31fd51['registerPlugin'](Me['UniverSheetsDrawingPlugin']),_0x31fd51['registerPlugin'](Fe['UniverSheetsSortPlugin']),_0x31fd51['registerPlugin'](be['UniverSheetsChartPlugin']),_0x31fd51['registerPlugin'](Pe['UniverSheetsNotePlugin']),_0x31fd51['registerPlugin'](we['UniverSheetsShapePlugin']),_0x31fd51['registerPlugin'](Ce['UniverSheetsPivotChartPlugin']),_0x31fd51['registerPlugin'](Le['UniverSheetsThreadCommentPlugin']);}function Dn(_0x3d2d31){_0x3d2d31['registerPlugin'](x['UniverSlidesPlugin']),_0x3d2d31['registerPlugin'](b['UniverSlidesChartPlugin']),_0x3d2d31['registerPlugin'](S['UniverSlidesTablePlugin']),_0x3d2d31['registerPlugin'](Ee['UniverSlidesThreadCommentPlugin']);}function On(_0x4937eb){_0x4937eb['registerPlugin'](re['UniverBoardsPlugin']),_0x4937eb['registerPlugin'](ce['UniverBoardsChartPlugin']),_0x4937eb['registerPlugin'](ue['UniverBoardsTablePlugin']),_0x4937eb['registerPlugin'](le['UniverBoardsMindPlugin']),_0x4937eb['registerPlugin'](de['UniverBoardsThreadCommentPlugin']);}function kn(_0x168a99){_0x168a99['registerPlugin'](p['UniverBasesPlugin']),_0x168a99['registerPlugin'](oe['UniverBaseDashboardPlugin'],{'notExecuteCalculation':!0x0}),_0x168a99['registerPlugin'](se['UniverBasesThreadCommentPlugin']);}var An=class{['univer'];['instanceService'];['commandService'];['revisionService'];['compressMutationService'];['snapshotService'];['snapshotSaveService'];['snapshotBridge'];constructor(_0x5d3603){this['univer']=new d['Univer']({'locale':d['LocaleType']['EN_US'],'locales':{[d['LocaleType']['EN_US']]:f['default']},'logLevel':d['LogLevel']['SILENT']});try{let _0x1dd2bf=this['univer']['__getInjector']();this['snapshotBridge']=new bn(_0x5d3603),_0x1dd2bf['add']([l['ISnapshotServerService'],{'useValue':this['snapshotBridge']}]),_0x1dd2bf['add']([l['SnapshotSaveService']]),Cn(this['univer']),this['instanceService']=_0x1dd2bf['get'](d['IUniverInstanceService']),this['commandService']=_0x1dd2bf['get'](d['ICommandService']),this['revisionService']=_0x1dd2bf['get'](l['RevisionService']),this['compressMutationService']=_0x1dd2bf['get'](l['CompressMutationService']),this['snapshotService']=_0x1dd2bf['get'](l['SnapshotService']),this['snapshotSaveService']=_0x1dd2bf['get'](l['SnapshotSaveService']);}catch(_0xa9ba1e){throw this['univer']['dispose'](),_0xa9ba1e;}}async['loadSnapshot'](_0x35287d,_0x594d38,_0x4c5508){let {unitID:_0x325b4f,type:_0x4f4dc9,revision:_0x4b277a}=_0x594d38,_0x25a892=this['snapshotBridge']['createContext'](_0x35287d,_0x4c5508);switch(_0x4f4dc9){case c['UniverType']['UNIVER_SHEET']:await this['snapshotService']['loadSheet'](_0x325b4f,_0x4b277a,_0x25a892);return;case c['UniverType']['UNIVER_DOC']:await this['snapshotService']['loadDoc'](_0x325b4f,_0x4b277a,_0x25a892),gn(this['commandService']);return;case c['UniverType']['UNIVER_SLIDE']:await this['snapshotService']['loadSlide'](_0x325b4f,_0x4b277a,_0x25a892);return;case c['UniverType']['UNIVER_BOARD']:await this['snapshotService']['loadBoard'](_0x325b4f,_0x4b277a,_0x25a892);return;case c['UniverType']['UNIVER_BASE']:await this['snapshotService']['loadBase'](_0x325b4f,_0x4b277a,_0x25a892);return;}throw Error('Unsupported\x20Unit\x20type:\x20'+_0x4f4dc9);}['assertLoadedRevision'](_0x4dd6f0){if(this['revisionService']['getCurrentRevOfUnit'](_0x4dd6f0['unitID'])!==_0x4dd6f0['revision'])throw Error('SDK\x20loaded\x20Unit\x20at\x20an\x20unexpected\x20revision');}async['restoreSnapshot'](_0x528770,_0x3d8be4,_0xc6f50b){this['instanceService']['disposeUnit'](_0x3d8be4['unitID']),await this['loadSnapshot'](_0x528770,_0x3d8be4,_0xc6f50b);}['adoptRestoredRevision'](_0x117c41,_0x4f537c){if(this['revisionService']['setRevOfUnit'](_0x117c41['unitID'],_0x4f537c),this['revisionService']['getCurrentRevOfUnit'](_0x117c41['unitID'])!==_0x4f537c)throw Error('Univer\x20Runtime\x20did\x20not\x20adopt\x20the\x20restored\x20revision');_0x117c41['advanceTo'](_0x4f537c);}async['createSnapshot'](_0x196922){if(_0x196922['type']===c['UniverType']['UNIVER_SHEET'])return this['_createSheetSnapshot'](_0x196922);let _0x16bc20=await this['snapshotBridge']['capture'](()=>this['_createProtocolSnapshot'](_0x196922)),_0x156ae1=_0x16bc20['result']['snapshot']??_0x16bc20['snapshot'];if(!_0x156ae1)throw Error('SDK\x20snapshot\x20generation\x20returned\x20no\x20snapshot');return{'snapshot':_0x156ae1,..._0x16bc20['sheetBlocks']['length']>0x0?{'sheetBlocks':_0x16bc20['sheetBlocks']}:{}};}async['applyChangeset'](_0x3fdf48,_0x5d2929,_0xbad9b3,_0x1d3095){if(_0x5d2929['unitID']!==_0x3fdf48['unitID']||_0x5d2929['type']!==_0x3fdf48['type']||_0x5d2929['baseRev']!==_0x3fdf48['revision']||_0x5d2929['revision']!==_0x3fdf48['revision']+0x1)throw Error('Changeset\x20does\x20not\x20follow\x20the\x20Runtime\x20revision');let _0x35ca13=(0x0,l['parseProtocolChangeset'])(_0x5d2929),_0x22f9b6=_0x35ca13['mutations']['find'](_0x153dfd=>_0x153dfd['id']===l['RevertRevisionMutation']['id']);if(_0x22f9b6){if(_0x35ca13['mutations']['length']!==0x1)throw new C('INVALID_REQUEST','A\x20restore\x20changeset\x20cannot\x20contain\x20other\x20mutations');let _0x2691c8=_0x22f9b6['params'];if(_0x2691c8['unitId']!==_0x3fdf48['unitID']||!Number['isSafeInteger'](_0x2691c8['revision'])||_0x2691c8['revision']<0x1||_0x2691c8['revision']>_0x5d2929['baseRev'])throw new C('INVALID_REQUEST','Restore\x20target\x20must\x20identify\x20an\x20existing\x20revision\x20of\x20this\x20Unit');let _0x2ad07f={'requiredUnitPermissions':[]};if(_0xbad9b3['collectUnitPermissions']){let _0x389fd3=new mn(this['univer'],_0x3fdf48),_0x42dcda=performance['now']();_0x389fd3['collect'](_0x22f9b6);let _0x2b038c=performance['now']()-_0x42dcda;_0x2ad07f={'requiredUnitPermissions':_0x389fd3['finish'](),'permissionAnalysisDurationMs':_0x2b038c};}return await _0x1d3095(_0x2691c8['revision']),_0x2ad07f;}let _0x365923=this['compressMutationService']['interceptor']['fetchThroughInterceptors'](this['compressMutationService']['interceptor']['getInterceptPoints']()['COMPRESS_MUTATION_APPLY'])(_0x35ca13['mutations'],null)??_0x35ca13['mutations'],_0x5cd1bf=this['_applyMutations'](_0x3fdf48,_0x5d2929,_0x365923,_0xbad9b3['collectUnitPermissions']===!0x0),_0x45202f=this['revisionService']['incrementRevOfUnit'](_0x3fdf48['unitID']);if(_0x45202f!==_0x5d2929['revision'])throw Error('Univer\x20Runtime\x20revision\x20did\x20not\x20advance\x20as\x20expected');return _0x3fdf48['advanceTo'](_0x45202f),_0x5cd1bf;}['_applyMutations'](_0xb8204,_0x1448bb,_0xa87aa4,_0x36caf8){if(!_0x36caf8)return this['_executeMutationBatch'](_0x1448bb,_0xa87aa4),{'requiredUnitPermissions':[]};let _0x124765=new mn(this['univer'],_0xb8204),_0x4a511c=0x0;for(let [_0xa696d7,_0x5eefa7]of _0xa87aa4['entries']()){let _0x48764e=performance['now']();_0x124765['collect'](_0x5eefa7),_0x4a511c+=performance['now']()-_0x48764e,this['_executeMutationBatch'](_0x1448bb,[_0x5eefa7],_0xa696d7);}return{'requiredUnitPermissions':_0x124765['finish'](),'permissionAnalysisDurationMs':_0x4a511c};}['_executeMutationBatch'](_0x48d322,_0xc5039c,_0x255be4=0x0){let _0x3e06f6=(0x0,d['sequenceExecute'])(_0xc5039c,this['commandService'],{'fromChangeset':!0x0});if(_0x3e06f6['result'])return;let _0x639262=_0xc5039c[_0x3e06f6['index']],_0x42eea7=_0x255be4+_0x3e06f6['index'];throw new C('INTERNAL_ERROR','Unit\x20Runtime\x20failed\x20to\x20execute\x20mutation\x20\x22'+_0x639262['id']+'\x22\x20for\x20Unit\x20\x22'+_0x48d322['unitID']+'\x22\x20at\x20revision\x20'+_0x48d322['revision']+'\x20(index\x20'+_0x42eea7+')',{'retryable':!0x0,'cause':_0x3e06f6['error']});}async['_createSheetSnapshot'](_0x3974ba){let _0x39f986=this['_requireSdkUnit'](_0x3974ba,d['UniverInstanceType']['UNIVER_SHEET']),_0x12f5c2=this['snapshotService']['saveSheet']({},_0x39f986);_0x12f5c2['sheetOrder']=_0x39f986['getSheets']()['map'](_0x2a816d=>_0x2a816d['getSheetId']());let {snapshot:_0x2b53af,sheetBlocks:_0x54aabb}=await(0x0,ne['materializeWorkbookSnapshot'])(_0x12f5c2,_0x3974ba['unitID'],_0x3974ba['revision']);if(!_0x2b53af['workbook'])throw Error('SDK\x20Sheet\x20snapshot\x20has\x20no\x20workbook\x20payload');return{'snapshot':_0x2b53af,'sheetBlocks':Object['entries'](_0x54aabb)['flatMap'](([_0x7770e,_0x2f857a])=>{let _0x581b22=_0x2b53af['workbook']['blockMeta'][_0x7770e];if(!_0x581b22)throw Error('SDK\x20Sheet\x20snapshot\x20has\x20no\x20block\x20metadata\x20for\x20'+_0x7770e);let _0x3e1110=_0x2f857a['map'](_0x2b7254=>({..._0x2b7254,'id':(0x0,te['randomUUID'])()}));return _0x581b22['blocks']=_0x3e1110['map'](_0x53b049=>_0x53b049['id']),_0x3e1110;})};}async['_createProtocolSnapshot'](_0xefc575){let _0x40a305={};switch(_0xefc575['type']){case c['UniverType']['UNIVER_DOC']:{let _0x1b8470=this['_requireSdkUnit'](_0xefc575,d['UniverInstanceType']['UNIVER_DOC']);return this['snapshotSaveService']['getDoc'](_0x40a305,_0xefc575['unitID'],_0xefc575['revision'],_0x1b8470);}case c['UniverType']['UNIVER_SLIDE']:{let _0x363af0=this['_requireSdkUnit'](_0xefc575,d['UniverInstanceType']['UNIVER_SLIDE']);return this['snapshotService']['saveSlide'](_0xefc575['unitID'],_0x363af0['getSnapshot'](),_0xefc575['revision']);}case c['UniverType']['UNIVER_BOARD']:{let _0x26e691=this['_requireSdkUnit'](_0xefc575,d['UniverInstanceType']['UNIVER_BOARD']);return this['snapshotService']['saveBoard'](_0xefc575['unitID'],_0x26e691['getSnapshot'](),_0xefc575['revision']);}case c['UniverType']['UNIVER_BASE']:{let _0x119217=this['_requireSdkUnit'](_0xefc575,d['UniverInstanceType']['UNIVER_BASE']);return this['snapshotSaveService']['getBase'](_0x40a305,_0xefc575['unitID'],_0xefc575['revision'],_0x119217);}}throw Error('Unsupported\x20Unit\x20type:\x20'+_0xefc575['type']);}['_requireSdkUnit'](_0x10fcc9,_0x23845a){let _0x3f1ad9=this['instanceService']['getUnit'](_0x10fcc9['unitID'],_0x23845a);if(!_0x3f1ad9||this['revisionService']['getCurrentRevOfUnit'](_0x10fcc9['unitID'])!==_0x10fcc9['revision'])throw Error('Runtime\x20Unit\x20or\x20revision\x20is\x20unavailable');return _0x3f1ad9;}['dispose'](){this['univer']['dispose']();}},jn=0x5f5e100,Mn=class{['_reader'];['_instanceManager'];['_ensuring']=new Map();['_disposed']=!0x1;constructor(_0x2666f6){this['_reader']=_0x2666f6['reader'];let _0xe79787=_0x2666f6['maxLoadedUnits']??0x4b0,_0x4fe0cc=_0x2666f6['idleTimeoutMs']??0x2bf20;if(!Number['isSafeInteger'](_0xe79787)||_0xe79787<0x1)throw TypeError('maxLoadedUnits\x20must\x20be\x20a\x20positive\x20safe\x20integer');if(!Number['isSafeInteger'](_0x4fe0cc)||_0x4fe0cc<0x1)throw TypeError('idleTimeoutMs\x20must\x20be\x20a\x20positive\x20safe\x20integer');this['_instanceManager']=new dt({'maxLoadedUnits':_0xe79787,'idleTimeoutMs':_0x4fe0cc,'minimumAvailableMemoryBytes':jn},new lt());}['ensureUnit'](_0x35e3a0,_0x3a084b,_0x52f87d){this['_assertOpen']();let _0x482799=this['_ensuring']['get'](_0x3a084b);if(_0x482799)return _0x482799['then'](_0x13f3cc=>(this['_instanceManager']['retain'](_0x13f3cc),_0x13f3cc['handle']));let _0x8205f1=this['_ensureUnit'](_0x35e3a0,_0x3a084b,_0x52f87d)['finally'](()=>{this['_ensuring']['get'](_0x3a084b)===_0x8205f1&&this['_ensuring']['delete'](_0x3a084b);});return this['_ensuring']['set'](_0x3a084b,_0x8205f1),_0x8205f1['then'](_0x5a9b2e=>this['_requireInstance'](_0x5a9b2e['handle'])['handle']);}['releaseUnit'](_0x34066c){let _0x13e363=this['_instanceManager']['getInstance'](_0x34066c['unitID']);_0x13e363?.['handle']===_0x34066c&&this['_instanceManager']['release'](_0x13e363);}async['applyChangeset'](_0x28ef8d,_0x39fd2b,_0xfa34e0,_0x367b54={}){this['_assertOpen']();let _0x428cd5=this['_requireInstance'](_0x39fd2b);return this['_withBusy'](_0x428cd5,async()=>{try{return await this['_applyConfirmedChangeset'](_0x28ef8d,_0x428cd5['handle'],_0xfa34e0,_0x367b54,_0x428cd5['instance']);}catch(_0x5dc836){throw this['disposeUnit'](_0x39fd2b['unitID']),_0x5dc836 instanceof C?_0x5dc836:new C('INTERNAL_ERROR','Failed\x20to\x20apply\x20changeset\x20to\x20Unit\x20Runtime',{'retryable':!0x0,'cause':_0x5dc836});}});}async['createSnapshot'](_0x2db54c){this['_assertOpen']();let _0x212895=this['_requireInstance'](_0x2db54c);return this['_withBusy'](_0x212895,async()=>{try{return await _0x212895['instance']['createSnapshot'](_0x212895['handle']);}catch(_0x25374a){throw this['disposeUnit'](_0x2db54c['unitID']),new C('INTERNAL_ERROR','Failed\x20to\x20create\x20Unit\x20Runtime\x20snapshot',{'retryable':!0x0,'cause':_0x25374a});}});}['disposeUnit'](_0x2100d5){this['_instanceManager']['disposeInstance'](_0x2100d5);}async['dispose'](){this['_disposed']||(this['_disposed']=!0x0,await this['_instanceManager']['dispose'](),await Promise['allSettled'](this['_ensuring']['values']()),this['_ensuring']['clear']());}async['_ensureUnit'](_0x10e66b,_0x46d26b,_0x2746e4){Nn(_0x46d26b,_0x2746e4);let _0x53c468=await this['_database'](()=>this['_reader']['getUnit'](_0x10e66b,_0x46d26b));if(!_0x53c468)throw new C('UNIT_NOT_FOUND','Unit\x20'+_0x46d26b+'\x20does\x20not\x20exist');if(_0x53c468['unitID']!==_0x46d26b)throw new C('ADAPTER_FAILURE','Stored\x20Unit\x20metadata\x20belongs\x20to\x20a\x20different\x20identity',{'retryable':!0x0});if(_0x53c468['type']!==_0x2746e4)throw new C('INVALID_REQUEST','Unit\x20type\x20does\x20not\x20match\x20the\x20stored\x20Unit');if(!Number['isSafeInteger'](_0x53c468['headRevision'])||_0x53c468['headRevision']<0x1)throw new C('ADAPTER_FAILURE','Stored\x20Unit\x20metadata\x20is\x20invalid',{'retryable':!0x0});let _0x20893c=this['_instanceManager']['getInstance'](_0x46d26b);if(_0x20893c&&(_0x20893c['handle']['type']!==_0x2746e4||_0x20893c['handle']['revision']>_0x53c468['headRevision'])&&(this['disposeUnit'](_0x46d26b),_0x20893c=void 0x0),_0x20893c){let _0x7e51cf=_0x20893c;this['_instanceManager']['retain'](_0x7e51cf);try{if(_0x7e51cf['handle']['revision']<_0x53c468['headRevision']&&await this['_replayRange'](_0x10e66b,_0x7e51cf['handle'],_0x7e51cf['handle']['revision'],_0x53c468['headRevision'],_0x7e51cf['instance']),this['_assertOpen'](),this['_instanceManager']['getInstance'](_0x46d26b)!==_0x7e51cf)throw Error('Unit\x20instance\x20was\x20invalidated\x20during\x20replay');return _0x7e51cf;}catch{this['_instanceManager']['getInstance'](_0x46d26b)===_0x7e51cf&&this['disposeUnit'](_0x46d26b),this['_instanceManager']['release'](_0x7e51cf);}}return this['_instanceManager']['ensureInstance'](_0x46d26b,()=>this['_loadUnit'](_0x10e66b,_0x46d26b,_0x2746e4,_0x53c468['headRevision']));}async['_loadUnit'](_0x2f378c,_0x19a9ad,_0x3afbc0,_0x5d7afb){let _0x369273=await this['_database'](()=>this['_reader']['getSnapshot'](_0x2f378c,_0x19a9ad,{'revision':_0x5d7afb}));if(!_0x369273||_0x369273['unitID']!==_0x19a9ad||_0x369273['type']!==_0x3afbc0||!Number['isSafeInteger'](_0x369273['rev'])||_0x369273['rev']<0x1||_0x369273['rev']>_0x5d7afb)throw new C('ADAPTER_FAILURE','Stored\x20Unit\x20snapshot\x20is\x20invalid',{'retryable':!0x0});this['_assertOpen']();let _0x33a758=new An(this['_reader']),_0xe4ab41=new D(_0x19a9ad,_0x3afbc0,_0x369273['rev']);try{if(await _0x33a758['loadSnapshot'](_0x2f378c,_0xe4ab41,_0x369273),_0x33a758['assertLoadedRevision'](_0xe4ab41),_0x369273['rev']<_0x5d7afb&&await this['_replayRange'](_0x2f378c,_0xe4ab41,_0x369273['rev'],_0x5d7afb,_0x33a758),_0xe4ab41['revision']!==_0x5d7afb)throw Error('Runtime\x20did\x20not\x20reach\x20the\x20requested\x20revision');return this['_assertOpen'](),{'handle':_0xe4ab41,'instance':_0x33a758};}catch(_0x2d3caf){throw _0x33a758['dispose'](),_0x2d3caf instanceof C?_0x2d3caf:new C('INTERNAL_ERROR','Failed\x20to\x20load\x20Unit\x20Runtime',{'retryable':!0x0,'cause':_0x2d3caf});}}async['_replayRange'](_0x43dc75,_0x40c7d0,_0x4b4f9a,_0x197717,_0x185d3d){let _0x44ef81=await this['_database'](()=>this['_reader']['getChangesets'](_0x43dc75,_0x40c7d0['unitID'],{'from':_0x4b4f9a,'to':_0x197717}));if(_0x44ef81===null)throw new C('ADAPTER_FAILURE','Unit\x20is\x20unavailable\x20during\x20replay',{'retryable':!0x0});let _0x3b184b=_0x4b4f9a+0x1;for(let _0x3ebf3f of _0x44ef81){if(_0x3ebf3f['unitID']!==_0x40c7d0['unitID']||_0x3ebf3f['type']!==_0x40c7d0['type']||_0x3ebf3f['baseRev']!==_0x3b184b-0x1||_0x3ebf3f['revision']!==_0x3b184b)throw new C('ADAPTER_FAILURE','Stored\x20changeset\x20history\x20is\x20not\x20contiguous',{'retryable':!0x0});await this['_applyConfirmedChangeset'](_0x43dc75,_0x40c7d0,_0x3ebf3f,{},_0x185d3d),_0x3b184b+=0x1;}if(_0x3b184b-0x1!==_0x197717)throw new C('ADAPTER_FAILURE','Stored\x20changeset\x20history\x20is\x20incomplete',{'retryable':!0x0});}['_applyConfirmedChangeset'](_0x2d2454,_0x1694ff,_0x5e3d89,_0x20927d,_0x5787e6){return _0x5787e6['applyChangeset'](_0x1694ff,_0x5e3d89,_0x20927d,_0x27e401=>this['_restoreHistoricalRevision'](_0x2d2454,_0x1694ff,_0x5e3d89,_0x27e401,_0x5787e6));}async['_restoreHistoricalRevision'](_0x4238dc,_0x1ca1e9,_0x5ef7c5,_0x5c8a7d,_0x4e6b9a){let _0x17120e=await this['_database'](()=>this['_reader']['getSnapshot'](_0x4238dc,_0x1ca1e9['unitID'],{'revision':_0x5c8a7d}));if(!_0x17120e||_0x17120e['unitID']!==_0x1ca1e9['unitID']||_0x17120e['type']!==_0x1ca1e9['type']||!Number['isSafeInteger'](_0x17120e['rev'])||_0x17120e['rev']<0x1||_0x17120e['rev']>_0x5c8a7d)throw new C('ADAPTER_FAILURE','Stored\x20restore\x20snapshot\x20is\x20invalid',{'retryable':!0x0});let _0x31bf91=new D(_0x1ca1e9['unitID'],_0x1ca1e9['type'],_0x17120e['rev']);if(await _0x4e6b9a['restoreSnapshot'](_0x4238dc,_0x31bf91,_0x17120e),_0x31bf91['revision']<_0x5c8a7d&&await this['_replayRange'](_0x4238dc,_0x31bf91,_0x31bf91['revision'],_0x5c8a7d,_0x4e6b9a),_0x31bf91['revision']!==_0x5c8a7d)throw new C('ADAPTER_FAILURE','Restore\x20history\x20did\x20not\x20reach\x20its\x20target\x20revision',{'retryable':!0x0});_0x4e6b9a['adoptRestoredRevision'](_0x1ca1e9,_0x5ef7c5['revision']);}['_requireInstance'](_0x3fa991){let _0x544b6a=this['_instanceManager']['getInstance'](_0x3fa991['unitID']);if(!_0x544b6a||_0x544b6a['handle']!==_0x3fa991||_0x544b6a['handle']['type']!==_0x3fa991['type'])throw new C('INTERNAL_ERROR','Unit\x20Runtime\x20handle\x20is\x20stale',{'retryable':!0x0});return _0x544b6a;}async['_withBusy'](_0x11c0d2,_0x4a7bf2){this['_instanceManager']['retain'](_0x11c0d2);try{return await _0x4a7bf2();}finally{this['_instanceManager']['release'](_0x11c0d2);}}async['_database'](_0x248213){try{return await _0x248213();}catch(_0x57c189){throw _0x57c189 instanceof C?_0x57c189:new C('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x57c189});}}['_assertOpen'](){if(this['_disposed'])throw new C('INTERNAL_ERROR','Unit\x20Runtime\x20is\x20disposed',{'retryable':!0x0});}};function Nn(_0x5189a3,_0x35aac7){if(!_0x5189a3)throw new C('INVALID_REQUEST','unitID\x20is\x20required');if(!Pn['has'](_0x35aac7))throw new C('INVALID_REQUEST','Unsupported\x20Unit\x20type:\x20'+_0x35aac7);}var Pn=new Set([c['UniverType']['UNIVER_SHEET'],c['UniverType']['UNIVER_DOC'],c['UniverType']['UNIVER_SLIDE'],c['UniverType']['UNIVER_BOARD'],c['UniverType']['UNIVER_BASE']]);function Fn(_0x4515d6,_0x24f97b=0x0){let _0x1dbf6a={'name':_0x4515d6 instanceof Error?_0x4515d6['name']:'Error','message':_0x4515d6 instanceof Error?_0x4515d6['message']:String(_0x4515d6)};if(_0x4515d6 instanceof C&&(_0x1dbf6a['code']=_0x4515d6['code'],_0x1dbf6a['retryable']=_0x4515d6['retryable'],_0x4515d6['details']))try{_0x1dbf6a['details']=structuredClone(_0x4515d6['details']);}catch{}return _0x4515d6 instanceof Error&&_0x4515d6['cause']!==void 0x0&&_0x24f97b<0x3&&(_0x1dbf6a['cause']=Fn(_0x4515d6['cause'],_0x24f97b+0x1)),_0x1dbf6a;}function In(_0x302f4c){let _0x4e15fe=_0x302f4c['cause']?In(_0x302f4c['cause']):void 0x0;if(_0x302f4c['code'])return new C(_0x302f4c['code'],_0x302f4c['message'],{'retryable':_0x302f4c['retryable']??!0x1,..._0x302f4c['details']?{'details':_0x302f4c['details']}:{},..._0x4e15fe?{'cause':_0x4e15fe}:{}});let _0x4f24f0=Error(_0x302f4c['message'],{'cause':_0x4e15fe});return _0x4f24f0['name']=_0x302f4c['name'],_0x4f24f0;}function G(_0x1de279){return new C('INTERNAL_ERROR',_0x1de279,{'retryable':!0x0});}var Ln=class{['_reader'];['_timeoutMs'];['_worker'];['_pending']=new Map();['_handles']=new WeakMap();['_generations']=new Map();['_ensuring']=new Set();['_nextID']=0x0;['_closed']=!0x1;['_failure'];['_disposal'];['_termination'];constructor(_0x50af0e,_0x154723,_0x49c5ac){this['_reader']=_0x50af0e,this['_timeoutMs']=_0x49c5ac;let _0x35680d=(0x0,ze['join'])(__dirname,'unit-runtime-worker.cjs');this['_worker']=new Be['Worker'](_0x35680d,{'workerData':_0x154723}),this['_worker']['on']('message',_0x3e8b47=>{if(_0x3e8b47['kind']==='read'){this['_read'](_0x3e8b47);return;}let _0x3da530=this['_pending']['get'](_0x3e8b47['id']);_0x3da530&&(this['_pending']['delete'](_0x3e8b47['id']),clearTimeout(_0x3da530['timer']),_0x3e8b47['ok']?_0x3da530['resolve'](_0x3e8b47['value']):_0x3da530['reject'](In(_0x3e8b47['error'])),_0x3da530['resource']['emitDestroy'](),this['_pending']['size']||this['_worker']['unref']());}),this['_worker']['on']('error',_0x5cb307=>this['_fail'](G('Unit\x20Runtime\x20Worker\x20failed:\x20'+_0x5cb307['message']))),this['_worker']['on']('messageerror',()=>this['_fail'](G('Unit\x20Runtime\x20Worker\x20message\x20could\x20not\x20be\x20decoded'))),this['_worker']['on']('exit',_0x3d0ef0=>{(!this['_closed']||this['_pending']['size'])&&this['_fail'](G('Unit\x20Runtime\x20Worker\x20exited\x20('+_0x3d0ef0+')'));}),this['_worker']['unref']();}get['failed'](){return this['_failure']!==void 0x0;}async['ensureUnit'](_0x3ecd8b,_0x22aa3a,_0x5a0e27){this['_assertOpen']();let _0x54bf38={'unitID':_0x22aa3a,'valid':!0x0};this['_ensuring']['add'](_0x54bf38);try{let _0x52ce8e=await this['_call']({'method':'ensure','unitID':_0x22aa3a,'type':_0x5a0e27},_0x3ecd8b);if(!_0x54bf38['valid']||this['_closed']||this['_failure'])throw!this['_failure']&&!this['_closed']&&this['_control']({'method':'release','unitID':_0x22aa3a,'generationID':_0x52ce8e['generationID']}),G('Unit\x20Runtime\x20was\x20invalidated\x20while\x20loading');let _0x470bcc=this['_generations']['get'](_0x22aa3a);return _0x470bcc?.['wire']['generationID']!==_0x52ce8e['generationID']&&(_0x470bcc&&(_0x470bcc['valid']=!0x1),_0x470bcc={'wire':_0x52ce8e,'handle':new D(_0x22aa3a,_0x5a0e27,_0x52ce8e['revision']),'valid':!0x0,'references':0x0},this['_generations']['set'](_0x22aa3a,_0x470bcc),this['_handles']['set'](_0x470bcc['handle'],_0x470bcc)),_0x470bcc['handle']['advanceTo'](_0x52ce8e['revision']),_0x470bcc['references']+=0x1,_0x470bcc['handle'];}finally{this['_ensuring']['delete'](_0x54bf38);}}['releaseUnit'](_0x1ee479){let _0x475197=this['_handles']['get'](_0x1ee479);!_0x475197||_0x475197['references']===0x0||this['_closed']||this['_failure']||(--_0x475197['references']===0x0&&this['_generations']['get'](_0x475197['handle']['unitID'])===_0x475197&&this['_generations']['delete'](_0x475197['handle']['unitID']),this['_control']({'method':'release','unitID':_0x1ee479['unitID'],'generationID':_0x475197['wire']['generationID']}));}async['applyChangeset'](_0x4ec777,_0x2b8306,_0x21e9d7,_0x111e99={}){let _0x5a827c=this['_requireHandle'](_0x2b8306);try{let _0x5d7d65=await this['_call']({'method':'apply','unitID':_0x2b8306['unitID'],'generationID':_0x5a827c['wire']['generationID'],'changeset':_0x21e9d7,'options':_0x111e99},_0x4ec777);return this['_assertCurrent'](_0x5a827c),_0x5a827c['handle']['advanceTo'](_0x5d7d65['revision']),_0x5d7d65['result'];}catch(_0x1bbfb6){throw this['_invalidateGeneration'](_0x5a827c),_0x1bbfb6;}}async['createSnapshot'](_0x231d72){let _0x4babcf=this['_requireHandle'](_0x231d72);try{let _0x285c35=await this['_call']({'method':'snapshot','unitID':_0x231d72['unitID'],'generationID':_0x4babcf['wire']['generationID']});return this['_assertCurrent'](_0x4babcf),_0x285c35;}catch(_0x5edd85){throw this['_invalidateGeneration'](_0x4babcf),_0x5edd85;}}['disposeUnit'](_0x44e146){if(this['_closed']||this['_failure'])return;for(let _0x34c64d of this['_ensuring'])_0x34c64d['unitID']===_0x44e146&&(_0x34c64d['valid']=!0x1);let _0x45b4d8=this['_generations']['get'](_0x44e146);_0x45b4d8&&this['_invalidateGeneration'](_0x45b4d8),this['_control']({'method':'invalidate','unitID':_0x44e146});}['dispose'](){return this['_disposal']??=this['_dispose'](),this['_disposal'];}async['_dispose'](){this['_closed']=!0x0;try{!this['_failure']&&this['_nextID']>0x0&&await this['_call']({'method':'dispose'});}catch(_0x516d45){if(!this['_failure'])throw _0x516d45;}finally{this['_fail'](G('Unit\x20Runtime\x20is\x20disposed')),await this['_terminate']();}}['_requireHandle'](_0x2ba6a2){this['_assertOpen']();let _0x216b7a=this['_handles']['get'](_0x2ba6a2);if(!_0x216b7a?.['valid']||_0x216b7a['references']===0x0)throw G('Unit\x20Runtime\x20handle\x20is\x20stale');return _0x216b7a;}['_assertCurrent'](_0x5d4dcf){if(this['_assertOpen'](),!_0x5d4dcf['valid'])throw G('Unit\x20Runtime\x20handle\x20is\x20stale');}['_invalidateGeneration'](_0x30f8c2){_0x30f8c2['valid']=!0x1,this['_generations']['get'](_0x30f8c2['handle']['unitID'])===_0x30f8c2&&this['_generations']['delete'](_0x30f8c2['handle']['unitID']);}['_assertOpen'](){if(this['_failure'])throw this['_failure'];if(this['_closed'])throw G('Unit\x20Runtime\x20is\x20disposed');}['_control'](_0x334f6f){this['_call'](_0x334f6f)['catch'](_0x3e871f=>this['_fail'](_0x3e871f));}['_call'](_0x124af4,_0x26378d){if(this['_failure'])return Promise['reject'](this['_failure']);let _0x30042f=++this['_nextID'];return new Promise((_0x5a5950,_0x32df3a)=>{let _0x562523=setTimeout(()=>{this['_fail'](G('Unit\x20Runtime\x20Worker\x20operation\x20timed\x20out'));},this['_timeoutMs']),_0x59f2cd=new ie['AsyncResource']('UnitRuntimeOperation');this['_pending']['set'](_0x30042f,{'resolve':_0xcf3df7=>_0x5a5950(_0xcf3df7),'reject':_0x32df3a,'resource':_0x59f2cd,'timer':_0x562523,..._0x26378d?{'context':_0x26378d}:{}}),this['_worker']['ref']();try{this['_worker']['postMessage']({'kind':'call','id':_0x30042f,'userID':_0x26378d?.['userID']??'','command':_0x124af4});}catch(_0x2022a8){clearTimeout(_0x562523),this['_pending']['delete'](_0x30042f),_0x59f2cd['emitDestroy'](),this['_pending']['size']||this['_worker']['unref'](),_0x32df3a(new C('INVALID_REQUEST','Unit\x20Runtime\x20command\x20could\x20not\x20be\x20cloned',{'cause':_0x2022a8}));}});}async['_read'](_0x177572){let _0x59748a=this['_pending']['get'](_0x177572['operationID']);try{if(!_0x59748a?.['context'])throw G('Reader\x20request\x20outlived\x20its\x20owning\x20operation');let _0x5c1491=_0x59748a['context'],_0xfdc94b=await _0x59748a['resource']['runInAsyncScope'](()=>{switch(_0x177572['method']){case'getUnit':return this['_reader']['getUnit'](_0x5c1491,..._0x177572['args']);case'getSnapshot':return this['_reader']['getSnapshot'](_0x5c1491,..._0x177572['args']);case'getChangesets':return this['_reader']['getChangesets'](_0x5c1491,..._0x177572['args']);case'getSheetBlock':return this['_reader']['getSheetBlock'](_0x5c1491,..._0x177572['args']);}});this['_failure']||this['_worker']['postMessage']({'kind':'reply','id':_0x177572['id'],'ok':!0x0,'value':_0xfdc94b});}catch(_0x1be865){if(this['_failure'])return;try{this['_worker']['postMessage']({'kind':'reply','id':_0x177572['id'],'ok':!0x1,'error':Fn(_0x1be865)});}catch(_0x3edfa8){this['_fail'](G('Unit\x20Runtime\x20Reader\x20reply\x20failed:\x20'+String(_0x3edfa8)));}}}['_fail'](_0x1fe494){this['_failure']??=_0x1fe494;for(let _0xdbdb7c of this['_pending']['values']())clearTimeout(_0xdbdb7c['timer']),_0xdbdb7c['reject'](this['_failure']),_0xdbdb7c['resource']['emitDestroy']();this['_pending']['clear']();for(let _0x4cd646 of this['_generations']['values']())_0x4cd646['valid']=!0x1;this['_generations']['clear']();for(let _0x2a02e9 of this['_ensuring'])_0x2a02e9['valid']=!0x1;this['_terminate']();}['_terminate'](){return this['_termination']??=this['_worker']['terminate'](),this['_termination'];}},Rn=0x7fffffff,zn=class{['_workers'];['_owners']=new WeakMap();['_retiring']=new Set();['_reader'];['_capacity'];['_idleTimeoutMs'];['_timeoutMs'];['_closed']=!0x1;['_disposal'];constructor(_0x15f05f){this['_reader']=_0x15f05f['reader'];let _0x42d698=_0x15f05f['execution']?.['mode']==='worker'?_0x15f05f['execution']:void 0x0;this['_capacity']=_0x15f05f['maxLoadedUnits']??0x4b0;let _0x56e3a8=_0x42d698?.['workerCount']??Math['min'](this['_capacity'],Math['max'](0x1,Math['floor']((0x0,Re['availableParallelism'])()/0x2)));this['_idleTimeoutMs']=_0x15f05f['idleTimeoutMs']??0x2bf20,this['_timeoutMs']=_0x42d698?.['operationTimeoutMs']??0x1d4c0;for(let [_0x2fbd58,_0xed8136]of Object['entries']({'maxLoadedUnits':this['_capacity'],'idleTimeoutMs':this['_idleTimeoutMs'],'workerCount':_0x56e3a8,'operationTimeoutMs':this['_timeoutMs']}))if(!Number['isSafeInteger'](_0xed8136)||_0xed8136<0x1)throw TypeError(_0x2fbd58+'\x20must\x20be\x20a\x20positive\x20safe\x20integer');if(_0x56e3a8>this['_capacity'])throw TypeError('workerCount\x20must\x20not\x20exceed\x20maxLoadedUnits');if(this['_timeoutMs']>Rn)throw TypeError('operationTimeoutMs\x20exceeds\x20the\x20Node\x20timer\x20limit');this['_workers']=Array['from']({'length':_0x56e3a8});for(let _0x364ebe=0x0;_0x364ebe<_0x56e3a8;_0x364ebe+=0x1)try{this['_workers'][_0x364ebe]=this['_createWorker'](_0x364ebe);}catch{break;}}async['ensureUnit'](_0x443b09,_0x63deff,_0x13e676){this['_assertOpen']();let _0x4e0b14=this['_shard'](_0x63deff),_0x5ae376=this['_workers'][_0x4e0b14];if(!_0x5ae376||_0x5ae376['failed']){if(_0x5ae376){let _0x4aaf56=_0x5ae376['dispose']()['finally'](()=>this['_retiring']['delete'](_0x4aaf56));this['_retiring']['add'](_0x4aaf56);}_0x5ae376=this['_createWorker'](_0x4e0b14),this['_workers'][_0x4e0b14]=_0x5ae376;}let _0x4cc07f=await _0x5ae376['ensureUnit'](_0x443b09,_0x63deff,_0x13e676);return this['_owners']['set'](_0x4cc07f,_0x5ae376),_0x4cc07f;}['releaseUnit'](_0x2954ac){this['_owners']['get'](_0x2954ac)?.['releaseUnit'](_0x2954ac);}async['applyChangeset'](_0x380c07,_0x41d5e6,_0x503e56,_0x276d82){return this['_owner'](_0x41d5e6)['applyChangeset'](_0x380c07,_0x41d5e6,_0x503e56,_0x276d82);}async['createSnapshot'](_0x2af0bb){return this['_owner'](_0x2af0bb)['createSnapshot'](_0x2af0bb);}['disposeUnit'](_0x753ca0){this['_closed']||this['_workers'][this['_shard'](_0x753ca0)]?.['disposeUnit'](_0x753ca0);}['dispose'](){return this['_disposal']??=this['_dispose'](),this['_disposal'];}async['_dispose'](){this['_closed']=!0x0;let _0x45e68b=(await Promise['allSettled']([...this['_workers']['map'](_0x3198d9=>_0x3198d9?.['dispose']()),...this['_retiring']]))['find'](_0x2af0c1=>_0x2af0c1['status']==='rejected');if(_0x45e68b?.['status']==='rejected')throw _0x45e68b['reason'];}['_createWorker'](_0x7a4d4b){return new Ln(this['_reader'],{'maxLoadedUnits':Math['floor'](this['_capacity']/this['_workers']['length'])+ +(_0x7a4d4b<this['_capacity']%this['_workers']['length']),'idleTimeoutMs':this['_idleTimeoutMs']},this['_timeoutMs']);}['_owner'](_0x1266ea){this['_assertOpen']();let _0xa944bc=this['_owners']['get'](_0x1266ea);if(!_0xa944bc)throw G('Unit\x20Runtime\x20handle\x20is\x20stale\x20or\x20belongs\x20to\x20another\x20Runtime');return _0xa944bc;}['_assertOpen'](){if(this['_closed'])throw G('Unit\x20Runtime\x20is\x20disposed');}['_shard'](_0xfc246e){let _0x4b27df=0x811c9dc5;for(let _0x568616=0x0;_0x568616<_0xfc246e['length'];_0x568616+=0x1)_0x4b27df=Math['imul'](_0x4b27df^_0xfc246e['charCodeAt'](_0x568616),0x1000193);return(_0x4b27df>>>0x0)%this['_workers']['length'];}};function K(_0x4ec7eb){if(_0x4ec7eb['execution']&&!['in-process','worker']['includes'](_0x4ec7eb['execution']['mode']))throw TypeError('Unsupported\x20Unit\x20Runtime\x20execution\x20mode');return _0x4ec7eb['execution']?.['mode']==='in-process'?new Mn(_0x4ec7eb):new zn(_0x4ec7eb);}var Bn=class{['_options'];constructor(_0x6122da){this['_options']=_0x6122da;}async['submit'](_0x233bbf,_0x13abf9){let _0x778e55=_0x13abf9['changeset'];Vn(_0x778e55);let _0x50a8db={..._0x233bbf,'request':_0x13abf9};try{return await this['_options']['coordinator']['runExclusive'](_0x778e55['unitID'],async()=>{let _0x3c37ca=this['_options']['maxRevisionRetries']+0x1;for(let _0x60df37=0x1;_0x60df37<=_0x3c37ca;_0x60df37+=0x1){let _0x566fa9=await this['_attempt'](_0x50a8db,_0x233bbf,_0x13abf9,_0x778e55,_0x60df37);if(_0x566fa9['status']!=='retry-attempt')return _0x566fa9;}throw this['_options']['runtime']['disposeUnit'](_0x778e55['unitID']),new C('REVISION_MISMATCH','Changeset\x20could\x20not\x20be\x20committed\x20after\x20bounded\x20retries',{'retryable':!0x0});});}catch(_0x14cf87){throw _0x14cf87 instanceof C&&_0x14cf87['code']==='UNIT_NOT_FOUND'&&this['_options']['runtime']['disposeUnit'](_0x778e55['unitID']),_0x14cf87;}}async['_attempt'](_0x472f44,_0x2df593,_0x106766,_0x5d58d3,_0x2aeb76){let _0x1a593b=await this['_measure']('load',()=>this['_options']['runtime']['ensureUnit'](_0x472f44,_0x5d58d3['unitID'],_0x5d58d3['type']));try{let _0x15d13d=_0x1a593b['revision'];if(_0x5d58d3['baseRev']>_0x15d13d)throw new C('REVISION_MISMATCH','Changeset\x20base\x20revision\x20is\x20ahead\x20of\x20the\x20Unit\x20head');let _0x40f46d=await this['_getHistory'](_0x472f44,_0x5d58d3['unitID'],_0x5d58d3['type'],_0x5d58d3['baseRev'],_0x15d13d),_0x1e47be=Un(_0x40f46d,_0x5d58d3);if(_0x1e47be)return q(_0x1e47be,_0x5d58d3),J(_0x1e47be)&&await this['_ensureRestoreSnapshot'](_0x472f44,_0x1a593b,_0x1e47be)?(await this['_options']['onCommitted'](_0x2df593,_0x106766,_0x1e47be,[]),{'status':'committed','changeset':_0x1e47be}):{'status':'already-committed','changeset':_0x1e47be};let _0x1e0ad8=await this['_measure']('transform',async()=>this['_createCandidate'](_0x5d58d3,_0x40f46d,_0x15d13d)),_0xae9107=[],_0x1cd638=!0x1;try{let _0x9fab71={'userID':_0x2df593['userID'],'memberID':_0x2df593['memberID'],'customData':_0x2df593['customData'],'request':_0x106766,'attempt':_0x2aeb76,'currentRevision':_0x15d13d,'changeset':_0x1e0ad8};await this['_measure']('applyMiddleware',()=>this['_options']['middleware']['run']('applyChangeset',_0x9fab71,async()=>{let _0x46c834=await this['_measure']('executeMutations',()=>this['_options']['runtime']['applyChangeset'](_0x472f44,_0x1a593b,_0x1e0ad8,{'collectUnitPermissions':this['_options']['enableUnitPermissionAnalysis']===!0x0}));_0xae9107=_0x46c834['requiredUnitPermissions'];let _0xfd4b62=_0x46c834['permissionAnalysisDurationMs'];_0xfd4b62!==void 0x0&&this['_options']['metrics']['observe']('collaboration.submit.duration',_0xfd4b62,{'stage':'unitPermissionAnalysis'}),_0x1cd638=!0x0;}));let _0x2201c8=await this['_runCommitMiddleware'](_0x472f44,_0x2df593,_0x106766,_0x1e0ad8,_0x2aeb76,_0x15d13d,_0xae9107);if(!_0x2201c8)return this['_options']['runtime']['disposeUnit'](_0x5d58d3['unitID']),{'status':'retry-attempt'};switch(_0x2201c8['status']){case'revision-mismatch':if(!Number['isSafeInteger'](_0x2201c8['actualHeadRevision'])||_0x2201c8['actualHeadRevision']<0x1)throw X('Database\x20returned\x20an\x20invalid\x20head\x20revision\x20mismatch');return this['_options']['runtime']['disposeUnit'](_0x5d58d3['unitID']),this['_options']['metrics']['increment']('collaboration.submit.retry',{'reason':'revision-mismatch'}),{'status':'retry-attempt'};case'recovered-committed':return J(_0x2201c8['changeset'])?(await this['_ensureRestoreSnapshot'](_0x472f44,_0x1a593b,_0x2201c8['changeset']),await this['_options']['onCommitted'](_0x2df593,_0x106766,_0x2201c8['changeset'],_0xae9107),{'status':'committed','changeset':_0x2201c8['changeset']}):(this['_options']['runtime']['disposeUnit'](_0x5d58d3['unitID']),await this['_options']['onCommitted'](_0x2df593,_0x106766,_0x2201c8['changeset'],_0xae9107),await this['_snapshotBestEffort'](_0x472f44,void 0x0,_0x2201c8['changeset']),{'status':'committed','changeset':_0x2201c8['changeset']});case'committed':return q(_0x2201c8['changeset'],_0x1e0ad8,!0x0),J(_0x2201c8['changeset'])?(await this['_ensureRestoreSnapshot'](_0x472f44,_0x1a593b,_0x2201c8['changeset']),await this['_options']['onCommitted'](_0x2df593,_0x106766,_0x2201c8['changeset'],_0xae9107),{'status':'committed','changeset':_0x2201c8['changeset']}):(await this['_options']['onCommitted'](_0x2df593,_0x106766,_0x2201c8['changeset'],_0xae9107),await this['_snapshotBestEffort'](_0x472f44,_0x1a593b,_0x2201c8['changeset']),{'status':'committed','changeset':_0x2201c8['changeset']});}}catch(_0x45c72f){throw _0x1cd638&&this['_options']['runtime']['disposeUnit'](_0x5d58d3['unitID']),_0x45c72f;}}finally{this['_options']['runtime']['releaseUnit'](_0x1a593b);}}async['_runCommitMiddleware'](_0x518832,_0x5e887c,_0x11cfd0,_0x17f260,_0x4a19cb,_0x2cbaf6,_0x464c3b){let _0x2b3147,_0x343cf5,_0x3a233b={'userID':_0x5e887c['userID'],'memberID':_0x5e887c['memberID'],'customData':_0x5e887c['customData'],'request':_0x11cfd0,'attempt':_0x4a19cb,'expectedHeadRevision':_0x2cbaf6,'changeset':_0x17f260,'requiredUnitPermissions':_0x464c3b};try{await this['_measure']('commitMiddleware',()=>this['_options']['middleware']['run']('commitChangeset',_0x3a233b,async()=>{try{_0x2b3147=await this['_measure']('databaseCommit',()=>this['_database'](()=>this['_options']['dbAdapter']['commitChangeset'](_0x518832,{'changeset':_0x17f260})));}catch(_0x2421fe){throw _0x343cf5=_0x2421fe,_0x2421fe;}}));}catch(_0x284cbd){if(_0x2b3147)return this['_options']['logger']['error']('commitChangeset\x20middleware\x20failed\x20after\x20database\x20commit',{'error':Gn(_0x284cbd)}),_0x2b3147;if(!_0x343cf5)throw _0x284cbd;if(_0x343cf5 instanceof C&&!_0x343cf5['retryable'])throw _0x343cf5;}if(_0x2b3147)return _0x2b3147;let _0x29cc24=Un(await this['_getHistoryToLatest'](_0x518832,_0x17f260['unitID'],_0x17f260['type'],_0x2cbaf6),_0x17f260);return _0x29cc24?(q(_0x29cc24,_0x17f260),{'status':'recovered-committed','changeset':_0x29cc24}):(this['_options']['metrics']['increment']('collaboration.submit.retry',{'reason':'unknown-commit'}),null);}async['_getHistory'](_0xde1796,_0xd80926,_0x36c982,_0x1cecec,_0x1ec4cc){if(_0x1cecec===_0x1ec4cc)return[];let _0x333011=await this['_database'](()=>this['_options']['dbAdapter']['getChangesets'](_0xde1796,_0xd80926,{'from':_0x1cecec,'to':_0x1ec4cc}));if(_0x333011===null)throw X('Unit\x20is\x20unavailable\x20while\x20reading\x20changeset\x20history');let _0x26a307=_0x1cecec+0x1;for(let _0xcc6307 of _0x333011){if(_0xcc6307['unitID']!==_0xd80926||_0xcc6307['type']!==_0x36c982||_0xcc6307['baseRev']!==_0x26a307-0x1||_0xcc6307['revision']!==_0x26a307)throw X('Stored\x20changeset\x20history\x20is\x20not\x20contiguous');_0x26a307+=0x1;}if(_0x26a307-0x1!==_0x1ec4cc)throw X('Stored\x20changeset\x20history\x20is\x20incomplete');return _0x333011;}async['_getHistoryToLatest'](_0x86ec0f,_0x6d52c3,_0x57ee64,_0xb346b8){let _0x1b41b4=await this['_database'](()=>this['_options']['dbAdapter']['getChangesets'](_0x86ec0f,_0x6d52c3,{'from':_0xb346b8}));if(_0x1b41b4===null)throw X('Unit\x20is\x20unavailable\x20while\x20reading\x20changeset\x20history');let _0x2fd1d9=_0xb346b8+0x1;for(let _0x409cd9 of _0x1b41b4){if(_0x409cd9['unitID']!==_0x6d52c3||_0x409cd9['type']!==_0x57ee64||_0x409cd9['baseRev']!==_0x2fd1d9-0x1||_0x409cd9['revision']!==_0x2fd1d9)throw X('Stored\x20changeset\x20history\x20is\x20not\x20contiguous');_0x2fd1d9+=0x1;}return _0x1b41b4;}['_createCandidate'](_0xacf52c,_0x13c81c,_0x4b7078){return{...this['_options']['transformer']['transform'](_0xacf52c,_0x13c81c),'unitID':_0xacf52c['unitID'],'type':_0xacf52c['type'],'baseRev':_0x4b7078,'revision':_0x4b7078+0x1,'sid':_0xacf52c['sid'],'reqId':_0xacf52c['reqId']};}async['_snapshotBestEffort'](_0x298836,_0x21efa6,_0x2d0f43){let _0x14f54d=this['_options']['snapshotPolicy'];if(!_0x14f54d)return;let _0x43db62;try{await this['_measure']('snapshot',async()=>{let _0x274831=await this['_database'](()=>this['_options']['dbAdapter']['getSnapshotInfo'](_0x298836,_0x2d0f43['unitID']));if(!_0x274831||_0x274831['unitID']!==_0x2d0f43['unitID']||_0x274831['type']!==_0x2d0f43['type']||!Number['isSafeInteger'](_0x274831['rev'])||_0x274831['rev']<0x1)throw X('Database\x20returned\x20invalid\x20latest\x20snapshot\x20info');if(_0x274831['rev']>=_0x2d0f43['revision'])return;let _0x22153e=_0x2d0f43['revision']-_0x274831['rev'];if(!J(_0x2d0f43)&&!_0x14f54d['shouldCreate']({'unitID':_0x2d0f43['unitID'],'type':_0x2d0f43['type'],'revision':_0x2d0f43['revision'],'changesetBytes':Wn(_0x2d0f43),'revisionsSinceLastSnapshot':_0x22153e}))return;let _0x5888bd=_0x21efa6??(_0x43db62=await this['_options']['runtime']['ensureUnit'](_0x298836,_0x2d0f43['unitID'],_0x2d0f43['type'])),_0x1f9b69=await this['_options']['runtime']['createSnapshot'](_0x5888bd);await this['_database'](()=>this['_options']['dbAdapter']['saveSnapshot'](_0x298836,_0x1f9b69));});}catch(_0x593288){_0x593288 instanceof C&&_0x593288['code']==='UNIT_NOT_FOUND'&&this['_options']['runtime']['disposeUnit'](_0x2d0f43['unitID']),this['_options']['metrics']['increment']('collaboration.snapshot.failure'),this['_options']['logger']['warn']('Best-effort\x20snapshot\x20failed',{'unitID':_0x2d0f43['unitID'],'revision':_0x2d0f43['revision'],'error':Gn(_0x593288)});}finally{_0x43db62&&this['_options']['runtime']['releaseUnit'](_0x43db62);}}async['_ensureRestoreSnapshot'](_0x308c61,_0x429e29,_0x135aba){let _0x1bb2ef;try{return await this['_measure']('restoreSnapshot',async()=>{if((await this['_getValidatedSnapshot'](_0x308c61,_0x135aba))['rev']===_0x135aba['revision'])return!0x1;let _0x9f7311=_0x429e29??(_0x1bb2ef=await this['_options']['runtime']['ensureUnit'](_0x308c61,_0x135aba['unitID'],_0x135aba['type']));if(_0x9f7311['revision']!==_0x135aba['revision'])throw X('Unit\x20Runtime\x20is\x20not\x20at\x20the\x20committed\x20restore\x20revision');let _0x475060=await this['_options']['runtime']['createSnapshot'](_0x9f7311);if(_0x475060['snapshot']['unitID']!==_0x135aba['unitID']||_0x475060['snapshot']['type']!==_0x135aba['type']||_0x475060['snapshot']['rev']!==_0x135aba['revision'])throw X('Unit\x20Runtime\x20returned\x20an\x20invalid\x20restore\x20snapshot');try{await this['_database'](()=>this['_options']['dbAdapter']['saveSnapshot'](_0x308c61,_0x475060));}catch(_0xeb8107){if((await this['_getValidatedSnapshot'](_0x308c61,_0x135aba))['rev']!==_0x135aba['revision'])throw _0xeb8107;}return!0x0;});}catch(_0x4d7c03){throw this['_options']['metrics']['increment']('collaboration.snapshot.failure',{'reason':'restore-required'}),this['_options']['logger']['warn']('Required\x20restore\x20snapshot\x20failed',{'unitID':_0x135aba['unitID'],'revision':_0x135aba['revision'],'error':Gn(_0x4d7c03)}),_0x4d7c03;}finally{_0x1bb2ef&&this['_options']['runtime']['releaseUnit'](_0x1bb2ef);}}async['_getValidatedSnapshot'](_0x8a4488,_0x320cdb){let _0x1892e3=await this['_database'](()=>this['_options']['dbAdapter']['getSnapshot'](_0x8a4488,_0x320cdb['unitID'],{'revision':_0x320cdb['revision']}));if(!_0x1892e3||_0x1892e3['unitID']!==_0x320cdb['unitID']||_0x1892e3['type']!==_0x320cdb['type']||!Number['isSafeInteger'](_0x1892e3['rev'])||_0x1892e3['rev']<0x1||_0x1892e3['rev']>_0x320cdb['revision'])throw X('Database\x20returned\x20an\x20invalid\x20nearest\x20snapshot');return _0x1892e3;}async['_database'](_0x2399c0){try{return await _0x2399c0();}catch(_0x421e63){throw _0x421e63 instanceof C?_0x421e63:new C('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x421e63});}}async['_measure'](_0x187f78,_0x2f5544){let _0x20ed14=performance['now']();try{return await _0x2f5544();}finally{this['_options']['metrics']['observe']('collaboration.submit.duration',performance['now']()-_0x20ed14,{'stage':_0x187f78});}}};function Vn(_0x3ed3d7){if(!_0x3ed3d7['unitID'])throw Y('unitID\x20is\x20required');if(!Hn['has'](_0x3ed3d7['type']))throw Y('Unsupported\x20Unit\x20type');if(!Number['isSafeInteger'](_0x3ed3d7['baseRev'])||_0x3ed3d7['baseRev']<0x1)throw Y('baseRev\x20must\x20be\x20a\x20positive\x20safe\x20integer');if(!_0x3ed3d7['sid'])throw Y('sid\x20is\x20required');if(!Number['isSafeInteger'](_0x3ed3d7['reqId'])||_0x3ed3d7['reqId']<0x1)throw Y('reqId\x20must\x20be\x20a\x20positive\x20safe\x20integer');if(!Array['isArray'](_0x3ed3d7['mutations']))throw Y('changeset\x20mutations\x20must\x20be\x20an\x20array');}var Hn=new Set([c['UniverType']['UNIVER_SHEET'],c['UniverType']['UNIVER_DOC'],c['UniverType']['UNIVER_SLIDE'],c['UniverType']['UNIVER_BOARD'],c['UniverType']['UNIVER_BASE']]);function q(_0x2af7dd,_0x33aca2,_0x580542=!0x1){if(_0x2af7dd['unitID']!==_0x33aca2['unitID']||_0x2af7dd['type']!==_0x33aca2['type']||_0x2af7dd['sid']!==_0x33aca2['sid']||_0x2af7dd['reqId']!==_0x33aca2['reqId']||!Number['isSafeInteger'](_0x2af7dd['baseRev'])||_0x2af7dd['baseRev']<0x1||!Number['isSafeInteger'](_0x2af7dd['revision'])||_0x2af7dd['revision']!==_0x2af7dd['baseRev']+0x1||_0x580542&&(_0x2af7dd['baseRev']!==_0x33aca2['baseRev']||_0x2af7dd['revision']!==_0x33aca2['revision']||_0x2af7dd['userID']!==_0x33aca2['userID']||_0x2af7dd['memberID']!==_0x33aca2['memberID']))throw X('Database\x20returned\x20an\x20invalid\x20committed\x20changeset');}function Un(_0x12662f,_0x4592ee){return _0x12662f['find'](_0x335304=>_0x335304['sid']===_0x4592ee['sid']&&_0x335304['reqId']===_0x4592ee['reqId']);}function Wn(_0xfbd3ec){try{return new TextEncoder()['encode'](JSON['stringify'](_0xfbd3ec))['byteLength'];}catch{return _0xfbd3ec['mutationSize']??0x0;}}function J(_0x4ed022){return _0x4ed022['mutations']['some'](_0xd7e55b=>_0xd7e55b['id']==='univer.mutation.revert-version');}function Y(_0x350851){return new C('INVALID_REQUEST',_0x350851);}function X(_0x248777){return new C('ADAPTER_FAILURE',_0x248777,{'retryable':!0x0});}function Gn(_0x2aa10b){return _0x2aa10b instanceof Error?_0x2aa10b['message']:String(_0x2aa10b);}var Kn=class{['_univer'];['_transformService'];constructor(){this['_univer']=new d['Univer']({'locale':d['LocaleType']['EN_US'],'logLevel':d['LogLevel']['SILENT']}),this['_univer']['registerPlugin'](l['UniverCollaborationPlugin']),this['_transformService']=this['_univer']['__getInjector']()['get'](l['ITransformService']);}['transform'](_0x36fcda,_0x4281cf){let _0x23dd9b;try{_0x23dd9b=(0x0,l['parseProtocolChangeset'])(structuredClone(_0x36fcda));}catch(_0x5c9ec8){throw new C('INVALID_REQUEST','Changeset\x20is\x20malformed',{'cause':_0x5c9ec8});}let _0x39eaec;try{_0x39eaec=_0x4281cf['map'](_0x2c7e53=>(0x0,l['parseProtocolChangeset'])(structuredClone(_0x2c7e53)));}catch(_0x18e3cf){throw new C('ADAPTER_FAILURE','Stored\x20changeset\x20cannot\x20be\x20parsed',{'retryable':!0x0,'cause':_0x18e3cf});}if(_0x39eaec['length']>0x0){let _0x593996=this['_transformService']['transformChangesets'](_0x39eaec,[_0x23dd9b],!0x1);if((0x0,l['isTransformChangesetsFailure'])(_0x593996)||!_0x593996['c2Prime'][0x0])throw new C('OT_CONFLICT','Changeset\x20cannot\x20be\x20transformed',{'cause':(0x0,l['isTransformChangesetsFailure'])(_0x593996)?_0x593996['error']:void 0x0});_0x23dd9b=_0x593996['c2Prime'][0x0];}try{return(0x0,l['parseChangesetToProtocol'])(_0x23dd9b);}catch(_0x388b0b){throw new C('INTERNAL_ERROR','Transformed\x20changeset\x20cannot\x20be\x20serialized',{'retryable':!0x0,'cause':_0x388b0b});}}['dispose'](){this['_univer']['dispose']();}},qn=class{['_queues']=new Map();async['runExclusive'](_0x593b86,_0x16faa4){let _0xb86063=this['_queues']['get'](_0x593b86)??{'tail':Promise['resolve'](),'pending':0x0};_0xb86063['pending']+=0x1,this['_queues']['set'](_0x593b86,_0xb86063);let _0x365a09=_0xb86063['tail'],_0x4fabfb;_0xb86063['tail']=new Promise(_0x35e514=>{_0x4fabfb=_0x35e514;}),await _0x365a09;try{return await _0x16faa4();}finally{_0x4fabfb(),--_0xb86063['pending'],_0xb86063['pending']===0x0&&this['_queues']['get'](_0x593b86)===_0xb86063&&this['_queues']['delete'](_0x593b86);}}['runExclusiveMany'](_0xc58a48,_0x3aede7){let _0x14ee4a=[...new Set(_0xc58a48)]['sort'](),_0x3aac5d=_0x3ab3df=>{let _0x428702=_0x14ee4a[_0x3ab3df];return _0x428702===void 0x0?_0x3aede7():this['runExclusive'](_0x428702,()=>_0x3aac5d(_0x3ab3df+0x1));};return _0x3aac5d(0x0);}},Jn=class{['_onListenerError'];['_listeners']=new Map();constructor(_0x440665){this['_onListenerError']=_0x440665;}['on'](_0x4efac5,_0x25d555){let _0x10d985=this['_listeners']['get'](_0x4efac5)??[],_0x1d7b9e=_0x25d555;_0x10d985['push'](_0x1d7b9e),this['_listeners']['set'](_0x4efac5,_0x10d985);let _0x5dca9d=!0x1;return{'dispose':()=>{if(_0x5dca9d)return;_0x5dca9d=!0x0;let _0x24be46=_0x10d985['indexOf'](_0x1d7b9e);_0x24be46>=0x0&&_0x10d985['splice'](_0x24be46,0x1);}};}async['emit'](_0x42af0f,_0x46ca53){let _0x3aa47d=[...this['_listeners']['get'](_0x42af0f)??[]];for(let _0xa797e1 of _0x3aa47d)try{await _0xa797e1(_0x46ca53);}catch(_0x23d383){try{this['_onListenerError'](_0x23d383);}catch{}}}['clear'](){this['_listeners']['clear']();}},Yn=class{['_owner'];['_state']='running';['_activeCalls']=0x0;['_drainPromise'];['_resolveDrain'];['_disposePromise'];constructor(_0xbe8aef){this['_owner']=_0xbe8aef;}get['state'](){return this['_state'];}['run'](_0x40f050){return this['_state']==='running'?(this['_activeCalls']+=0x1,Promise['resolve']()['then'](_0x40f050)['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'](_0x2b5a66){return this['_disposePromise']?this['_disposePromise']:(this['_state']='disposing',this['_disposePromise']=this['_finishDispose'](_0x2b5a66),this['_disposePromise']);}async['_finishDispose'](_0x2d471a){this['_activeCalls']>0x0&&(this['_drainPromise']=new Promise(_0x3b3ae7=>{this['_resolveDrain']=_0x3b3ae7;}),await this['_drainPromise']);try{await _0x2d471a();}finally{this['_state']='disposed';}}},Xn=new Set([c['UniverType']['UNIVER_SHEET'],c['UniverType']['UNIVER_DOC'],c['UniverType']['UNIVER_SLIDE'],c['UniverType']['UNIVER_BOARD'],c['UniverType']['UNIVER_BASE']]),Zn=0x64,Qn=class{['_dbAdapter'];['_middleware']=new Ke();['_lifecycle']=new Yn('Collaboration\x20Service');['_logger'];['_metrics'];['_events'];['_runtime'];['_transformer'];['_coordinator'];['_submitEngine'];constructor(_0x217490){if(!_0x217490?.['dbAdapter'])throw TypeError('UniverCollabService\x20requires\x20a\x20dbAdapter');this['_dbAdapter']=_0x217490['dbAdapter'],this['_logger']=Ye(_0x217490['logger']),this['_metrics']=Xe(_0x217490['metrics']),this['_events']=new Jn(_0x2b528e=>{this['_logger']['error']('Collaboration\x20Service\x20event\x20listener\x20failed',{'error':sr(_0x2b528e)});});let _0x1ab202=_0x217490['submitChangeset']?.['maxRevisionRetries']??0x3;if(!Number['isSafeInteger'](_0x1ab202)||_0x1ab202<0x0)throw TypeError('submitChangeset.maxRevisionRetries\x20must\x20be\x20a\x20non-negative\x20safe\x20integer');this['_runtime']=K({..._0x217490['runtime'],'reader':this['_dbAdapter']}),this['_transformer']=new Kn(),this['_coordinator']=new qn(),this['_submitEngine']=new Bn({'dbAdapter':this['_dbAdapter'],'middleware':this['_middleware'],'runtime':this['_runtime'],'transformer':this['_transformer'],'coordinator':this['_coordinator'],..._0x217490['snapshotPolicy']===!0x1?{}:{'snapshotPolicy':_0x217490['snapshotPolicy']??Ue},'enableUnitPermissionAnalysis':_0x217490['enableUnitPermissionAnalysis']??!0x1,'maxRevisionRetries':_0x1ab202,'logger':this['_logger'],'metrics':this['_metrics'],'onCommitted':(_0x5ecaa6,_0x10d1ee,_0x21a43a,_0x5686ca)=>this['_events']['emit']('changesetCommitted',{'userID':_0x5ecaa6['userID'],'memberID':_0x5ecaa6['memberID'],'customData':_0x5ecaa6['customData'],'request':_0x10d1ee,'changeset':_0x21a43a,'requiredUnitPermissions':_0x5686ca,'committedAt':Date['now']()})});}get['dbAdapter'](){return this['_dbAdapter'];}['use'](_0x5c5b4c,_0x1a7bbe){return this['_assertRunning'](),this['_middleware']['use'](_0x5c5b4c,_0x1a7bbe);}['on'](_0x4d42b1,_0xf98a87){return this['_assertRunning'](),this['_events']['on'](_0x4d42b1,_0xf98a87);}['getUnitLoadData'](_0x45d654,_0x1c3a7b){return this['_call']('getUnitLoadData',async()=>{let _0x3fc6cd=w(_0x1c3a7b),_0x368cf1=Ze(_0x45d654),_0x3071d0={..._0x3fc6cd,'request':_0x368cf1},_0x50c025;return await this['_middleware']['run']('readUnitData',_0x3071d0,async()=>{_0x50c025=await this['_getUnitLoadData'](_0x3071d0,_0x45d654);}),_0x50c025;});}['getUnitLoadDataWithBlocks'](_0x4f1382,_0x2ed51c){return this['_call']('getUnitLoadDataWithBlocks',async()=>{let _0x30c0ce=w(_0x2ed51c),_0x37f672=Ze(_0x4f1382),_0x4d600c={..._0x30c0ce,'request':_0x37f672},_0x2fcbd2;return await this['_middleware']['run']('readUnitData',_0x4d600c,async()=>{let _0x3b4809=await this['_getUnitLoadData'](_0x4d600c,_0x4f1382),_0x3dc458=await this['_getSnapshotSheetBlocks'](_0x4d600c,_0x3b4809['snapshot']);_0x2fcbd2={..._0x3b4809,'sheetBlocks':_0x3dc458};}),_0x2fcbd2;});}['getChangesets'](_0x8f515d,_0x2b7b46){return this['_call']('getChangesets',async()=>{let _0xa98c9f=w(_0x2b7b46),_0x478460=Qe(_0x8f515d),_0x3a4d90={..._0xa98c9f,'request':_0x478460},_0x3f8c0f;return await this['_middleware']['run']('readUnitData',_0x3a4d90,async()=>{Z(_0x8f515d['unitID'],_0x8f515d['type']),rr('from',_0x8f515d['from']),rr('to',_0x8f515d['to']);let _0x196022=await this['_requireUnit'](_0x3a4d90,_0x8f515d['unitID'],_0x8f515d['type']),_0x5ee407=_0x8f515d['to']===0x0?void 0x0:ir(_0x8f515d['to'],_0x196022);if(_0x8f515d['from']>(_0x5ee407??_0x196022['headRevision']))throw Q('Changeset\x20range\x20starts\x20after\x20its\x20target');let _0x5dab70=await this['_database'](()=>this['_dbAdapter']['getChangesets'](_0x3a4d90,_0x8f515d['unitID'],{'from':_0x8f515d['from'],..._0x5ee407===void 0x0?{}:{'to':_0x5ee407}}));if(_0x5dab70===null)throw new C('UNIT_NOT_FOUND','Unit\x20'+_0x8f515d['unitID']+'\x20does\x20not\x20exist');ar(_0x5dab70,_0x8f515d['unitID'],_0x8f515d['type'],Math['max'](_0x8f515d['from']+0x1,0x2),_0x5ee407),_0x3f8c0f={'changesets':_0x5dab70};}),_0x3f8c0f;});}['getSheetBlock'](_0x50c1ad,_0x2db4f0){return this['_call']('getSheetBlock',async()=>{let _0x32b91d=w(_0x2db4f0),_0x445702=$e(_0x50c1ad),_0x2a245f={..._0x32b91d,'request':_0x445702},_0x1e0152;return await this['_middleware']['run']('readUnitData',_0x2a245f,async()=>{if(Z(_0x50c1ad['unitID'],_0x50c1ad['type']),!_0x50c1ad['blockID'])throw Q('blockID\x20is\x20required');await this['_requireUnit'](_0x2a245f,_0x50c1ad['unitID'],_0x50c1ad['type']),_0x1e0152={'block':await this['_database'](()=>this['_dbAdapter']['getSheetBlock'](_0x2a245f,_0x50c1ad['unitID'],_0x50c1ad['blockID']))};}),_0x1e0152;});}['createUnitFromSnapshot'](_0xe70a17,_0x231f48){return this['_call']('createUnitFromSnapshot',()=>this['_createUnit'](_0xe70a17,w(_0x231f48)));}['createUnitFromData'](_0x52cf35,_0x3a32ab){return this['_call']('createUnitFromData',async()=>{if(!_0x52cf35||!Xn['has'](_0x52cf35['type']))throw Q('Unsupported\x20unit\x20type');if(!_0x52cf35['data']?.['id'])throw Q('data.id\x20is\x20required');if(_0x52cf35['data']['rev']!==0x1)throw Q('Initial\x20Unit\x20data\x20revision\x20must\x20be\x201');let _0x212705=w(_0x3a32ab),_0x9c8f7b=await it(_0x52cf35);return this['_createUnit'](_0x9c8f7b,_0x212705);});}['deleteUnits'](_0x705e7f,_0x204b6b){return this['_call']('deleteUnits',async()=>{let _0x1bf759=w(_0x204b6b),_0x2af4d2=$n(_0x705e7f?.['unitIDs']);if(_0x705e7f['hardDelete']!==void 0x0&&typeof _0x705e7f['hardDelete']!='boolean')throw Q('hardDelete\x20must\x20be\x20a\x20boolean');let _0x26541b=tt({'unitIDs':_0x2af4d2,'hardDelete':_0x705e7f['hardDelete']??!0x1}),_0x2bbfba={..._0x1bf759,'request':_0x26541b},_0x2fdf87;return await this['_coordinator']['runExclusiveMany'](_0x2af4d2,()=>this['_middleware']['run']('deleteUnits',_0x2bbfba,async()=>{let _0x18d094=await this['_database'](()=>this['_dbAdapter']['deleteUnits'](_0x2bbfba,{'unitIDs':_0x2af4d2,'hardDelete':_0x26541b['hardDelete']}));for(let _0x2ba39b of _0x2af4d2)this['_runtime']['disposeUnit'](_0x2ba39b);er(_0x18d094,_0x2af4d2,_0x26541b['hardDelete']),_0x2fdf87=_0x18d094,await this['_events']['emit']('unitsDeleted',{'userID':_0x1bf759['userID'],'customData':_0x1bf759['customData'],'request':_0x26541b,'result':_0x18d094,'deletedAt':Date['now']()});})),_0x2fdf87;});}['recoverUnits'](_0x33639c,_0x370eea){return this['_call']('recoverUnits',async()=>{let _0x72104a=w(_0x370eea),_0x34b239=$n(_0x33639c?.['unitIDs']),_0x17eed7=nt({'unitIDs':_0x34b239}),_0x17b4f4={..._0x72104a,'request':_0x17eed7},_0x133449;return await this['_coordinator']['runExclusiveMany'](_0x34b239,()=>this['_middleware']['run']('recoverUnits',_0x17b4f4,async()=>{let _0x4bc262=await this['_database'](()=>this['_dbAdapter']['recoverUnits'](_0x17b4f4,{'unitIDs':_0x34b239}));tr(_0x4bc262,_0x34b239),_0x133449=_0x4bc262,await this['_events']['emit']('unitsRecovered',{'userID':_0x72104a['userID'],'customData':_0x72104a['customData'],'request':_0x17eed7,'result':_0x4bc262,'recoveredAt':Date['now']()});})),_0x133449;});}async['submitChangeset'](_0x37db6d,_0x2b5a8a){try{return await this['_lifecycle']['run'](async()=>{let _0x3ff42d=We(_0x2b5a8a),_0xa4f6c8=rt(_0x37db6d,_0x3ff42d);_0xa4f6c8['changeset']['createTime']??=Math['floor'](Date['now']()/0x3e8);let _0x2583b0={..._0x3ff42d,'request':_0xa4f6c8},_0x52aee8;return await this['_middleware']['run']('submitChangeset',_0x2583b0,async()=>{_0x52aee8=await this['_submitEngine']['submit'](_0x2583b0,_0xa4f6c8);}),_0x52aee8;});}catch(_0x371c47){let _0x651312=this['_normalizeError']('submitChangeset',_0x371c47);return{'status':_0x651312['retryable']?'retry':'rejected','error':_0x651312};}}['dispose'](){return this['_lifecycle']['dispose'](async()=>{this['_middleware']['clear'](),this['_events']['clear'](),await this['_runtime']['dispose'](),this['_transformer']['dispose']();});}async['_getUnitLoadData'](_0x1f443c,_0x3b284f){Z(_0x3b284f['unitID'],_0x3b284f['type']),rr('revision',_0x3b284f['revision']);let _0xae3e14=await this['_requireUnit'](_0x1f443c,_0x3b284f['unitID'],_0x3b284f['type']),_0x497e0e=ir(_0x3b284f['revision'],_0xae3e14),_0x93cee6=await this['_database'](()=>this['_dbAdapter']['getSnapshot'](_0x1f443c,_0x3b284f['unitID'],{'revision':_0x497e0e}));if(!_0x93cee6)throw new C('ADAPTER_FAILURE','Database\x20returned\x20a\x20unit\x20without\x20a\x20recoverable\x20snapshot',{'retryable':!0x0});if(_0x93cee6['unitID']!==_0x3b284f['unitID']||_0x93cee6['type']!==_0x3b284f['type']||!Number['isSafeInteger'](_0x93cee6['rev'])||_0x93cee6['rev']<0x1||_0x93cee6['rev']>_0x497e0e)throw new C('ADAPTER_FAILURE','Database\x20returned\x20an\x20invalid\x20snapshot',{'retryable':!0x0});let _0x21cc28=await this['_database'](()=>this['_dbAdapter']['getChangesets'](_0x1f443c,_0x3b284f['unitID'],{'from':_0x93cee6['rev'],'to':_0x497e0e}));if(_0x21cc28===null)throw new C('UNIT_NOT_FOUND','Unit\x20'+_0x3b284f['unitID']+'\x20does\x20not\x20exist');return ar(_0x21cc28,_0x3b284f['unitID'],_0x3b284f['type'],_0x93cee6['rev']+0x1,_0x497e0e),{'snapshot':_0x93cee6,'changesets':_0x21cc28,'targetRevision':_0x497e0e};}async['_getSnapshotSheetBlocks'](_0x53c5b6,_0x5c6d9e){let _0x144cdd=st(_0x5c6d9e);return Promise['all'](_0x144cdd['map'](async _0x51a788=>{let _0xe33625=await this['_database'](()=>this['_dbAdapter']['getSheetBlock'](_0x53c5b6,_0x5c6d9e['unitID'],_0x51a788));if(!_0xe33625||_0xe33625['id']!==_0x51a788)throw or('Database\x20returned\x20an\x20invalid\x20referenced\x20Sheet\x20block\x20'+_0x51a788);return _0xe33625;}));}async['_createUnit'](_0x341d9a,_0x5857ba){let _0x53d62d=et(_0x341d9a),_0x5dcdcb={..._0x5857ba,'request':_0x53d62d},_0x3a64c6,{snapshot:_0x4f4304}=_0x341d9a;return await this['_coordinator']['runExclusive'](_0x4f4304['unitID'],()=>this['_middleware']['run']('createUnit',_0x5dcdcb,async()=>{if(Z(_0x4f4304['unitID'],_0x4f4304['type']),_0x4f4304['rev']!==0x1)throw Q('Initial\x20snapshot\x20revision\x20must\x20be\x201');let _0x28cefd=await this['_database'](()=>this['_dbAdapter']['createUnit'](_0x5dcdcb,{'record':{'unitID':_0x4f4304['unitID'],'type':_0x4f4304['type'],'headRevision':0x1,'creatorID':_0x5857ba['userID'],'createdAt':Date['now']()},'snapshot':_0x4f4304,..._0x341d9a['sheetBlocks']===void 0x0?{}:{'sheetBlocks':_0x341d9a['sheetBlocks']}}));if(_0x28cefd['record']['unitID']!==_0x4f4304['unitID']||_0x28cefd['record']['type']!==_0x4f4304['type']||!Number['isSafeInteger'](_0x28cefd['record']['headRevision'])||_0x28cefd['record']['headRevision']<0x1)throw new C('ADAPTER_FAILURE','Database\x20returned\x20an\x20invalid\x20created\x20unit\x20record',{'retryable':!0x0});_0x3a64c6={'status':_0x28cefd['status'],'unitID':_0x28cefd['record']['unitID'],'headRevision':_0x28cefd['record']['headRevision']},_0x28cefd['status']==='created'&&await this['_events']['emit']('unitCreated',{'userID':_0x5857ba['userID'],'customData':_0x5857ba['customData'],'request':_0x53d62d,'record':_0x28cefd['record'],'createdAt':Date['now']()});})),_0x3a64c6;}async['_requireUnit'](_0x535420,_0x153243,_0x20544d){let _0x21b6a8=await this['_database'](()=>this['_dbAdapter']['getUnit'](_0x535420,_0x153243));if(!_0x21b6a8)throw new C('UNIT_NOT_FOUND','Unit\x20'+_0x153243+'\x20does\x20not\x20exist');if(_0x21b6a8['unitID']!==_0x153243)throw new C('ADAPTER_FAILURE','Database\x20returned\x20Unit\x20metadata\x20for\x20a\x20different\x20identity',{'retryable':!0x0});if(_0x21b6a8['type']!==_0x20544d)throw Q('Unit\x20type\x20does\x20not\x20match\x20the\x20stored\x20unit');if(!Number['isSafeInteger'](_0x21b6a8['headRevision'])||_0x21b6a8['headRevision']<0x1)throw new C('ADAPTER_FAILURE','Database\x20returned\x20an\x20invalid\x20unit\x20head\x20revision',{'retryable':!0x0});return _0x21b6a8;}async['_database'](_0x161566){try{return await _0x161566();}catch(_0x13e984){throw _0x13e984 instanceof C?_0x13e984:new C('ADAPTER_FAILURE','Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x13e984});}}async['_call'](_0x466e1c,_0xcd3f81){try{return this['_metrics']['increment']('collaboration.service.call',{'operation':_0x466e1c}),await this['_lifecycle']['run'](_0xcd3f81);}catch(_0x33b5d3){throw this['_normalizeError'](_0x466e1c,_0x33b5d3);}}['_normalizeError'](_0x39b4a1,_0x20ce0d){return _0x20ce0d instanceof C?_0x20ce0d:(this['_logger']['error']('Collaboration\x20Service\x20operation\x20failed',{'operation':_0x39b4a1,'error':sr(_0x20ce0d)}),new C('INTERNAL_ERROR','Collaboration\x20Service\x20failed',{'retryable':!0x0,'cause':_0x20ce0d}));}['_assertRunning'](){if(this['_lifecycle']['state']!=='running')throw new C('INTERNAL_ERROR','Collaboration\x20Service\x20is\x20'+this['_lifecycle']['state'],{'retryable':!0x0});}};function Z(_0x420c93,_0x540631){if(!_0x420c93)throw Q('unitID\x20is\x20required');if(!Xn['has'](_0x540631))throw Q('Unsupported\x20unit\x20type');}function $n(_0x1297de){if(!Array['isArray'](_0x1297de)||_0x1297de['length']===0x0)throw Q('unitIDs\x20must\x20be\x20a\x20non-empty\x20array');if(_0x1297de['length']>0x64)throw Q('unitIDs\x20cannot\x20contain\x20more\x20than\x20100\x20values');let _0x2937df=[],_0x1a82fb=new Set();for(let _0x3614c1 of _0x1297de){if(typeof _0x3614c1!='string'||_0x3614c1['trim']()['length']===0x0)throw Q('unitIDs\x20cannot\x20contain\x20empty\x20values');_0x1a82fb['has'](_0x3614c1)||(_0x1a82fb['add'](_0x3614c1),_0x2937df['push'](_0x3614c1));}return _0x2937df;}function er(_0x2ad30b,_0x3cf160,_0x5e1018){let _0x4196f1=_0x5e1018?new Set(['hard-deleted','already-hard-deleted']):new Set(['soft-deleted','already-soft-deleted']);nr(_0x2ad30b?.['units'],_0x3cf160,_0x4196f1,'delete');}function tr(_0x4b8969,_0x125e4b){let _0x656055=new Set(['recovered','already-active']);nr(_0x4b8969?.['units'],_0x125e4b,_0x656055,'recover');}function nr(_0x5f018d,_0x382950,_0xe97deb,_0x41df02){if(!Array['isArray'](_0x5f018d)||_0x5f018d['length']!==_0x382950['length'])throw or('Database\x20returned\x20incomplete\x20'+_0x41df02+'\x20Unit\x20results');for(let [_0x3dfc6a,_0x3334fc]of _0x5f018d['entries']())if(!_0x3334fc||_0x3334fc['unitID']!==_0x382950[_0x3dfc6a]||!_0xe97deb['has'](_0x3334fc['status']))throw or('Database\x20returned\x20invalid\x20'+_0x41df02+'\x20Unit\x20results');}function rr(_0x4069e0,_0x2d09e0){if(!Number['isSafeInteger'](_0x2d09e0)||_0x2d09e0<0x0)throw Q(_0x4069e0+'\x20must\x20be\x20a\x20non-negative\x20safe\x20integer');}function ir(_0xbe803f,_0x4279de){let _0x17c392=_0xbe803f===0x0?_0x4279de['headRevision']:_0xbe803f;if(_0x17c392<0x1||_0x17c392>_0x4279de['headRevision'])throw Q('Requested\x20revision\x20is\x20outside\x20the\x20stored\x20unit\x20history');return _0x17c392;}function ar(_0x55e74a,_0x37197d,_0x1cda5f,_0x1e6300,_0x2609c8){let _0x4e364e=_0x1e6300;for(let _0x230140 of _0x55e74a){if(_0x230140['unitID']!==_0x37197d||_0x230140['type']!==_0x1cda5f||_0x230140['baseRev']!==_0x4e364e-0x1||_0x230140['revision']!==_0x4e364e)throw new C('ADAPTER_FAILURE','Database\x20returned\x20a\x20non-contiguous\x20changeset\x20history',{'retryable':!0x0});_0x4e364e+=0x1;}if(_0x2609c8!==void 0x0&&_0x4e364e-0x1!==_0x2609c8)throw new C('ADAPTER_FAILURE','Database\x20returned\x20an\x20incomplete\x20changeset\x20history',{'retryable':!0x0});}function Q(_0x140684){return new C('INVALID_REQUEST',_0x140684);}function or(_0x53bf67){return new C('ADAPTER_FAILURE',_0x53bf67,{'retryable':!0x0});}function sr(_0x3d72e2){return _0x3d72e2 instanceof Error?_0x3d72e2['message']:String(_0x3d72e2);}var cr=class{['_reader']=new lr();['_runtime'];['_coordinator']=new qn();['_lifecycle']=new Yn('Unit\x20Snapshot\x20Materializer');constructor(_0x13f4ac={}){this['_runtime']=K({..._0x13f4ac,'reader':this['_reader']});}['materializeSnapshot'](_0x50bdad){return this['_lifecycle']['run'](async()=>{ur(_0x50bdad);let {snapshot:_0x1f2d2c,targetRevision:_0x48dcc7}=_0x50bdad;return this['_coordinator']['runExclusive'](_0x1f2d2c['unitID'],async()=>{this['_runtime']['disposeUnit'](_0x1f2d2c['unitID']),this['_reader']['bind'](_0x50bdad);let _0x2e1dc0={'userID':'unit-snapshot-materializer','customData':Object['create'](null),'request':Object['create'](null)},_0x2d339e;try{_0x2d339e=await this['_runtime']['ensureUnit'](_0x2e1dc0,_0x1f2d2c['unitID'],_0x1f2d2c['type']);let _0x5c5a08=await this['_runtime']['createSnapshot'](_0x2d339e);if(_0x5c5a08['snapshot']['unitID']!==_0x1f2d2c['unitID']||_0x5c5a08['snapshot']['type']!==_0x1f2d2c['type']||_0x5c5a08['snapshot']['rev']!==_0x48dcc7)throw new C('INTERNAL_ERROR','Unit\x20Runtime\x20materialized\x20an\x20unexpected\x20snapshot\x20revision',{'retryable':!0x0});return{'snapshot':_0x5c5a08['snapshot'],'sheetBlocks':[..._0x5c5a08['sheetBlocks']??[]]};}finally{_0x2d339e&&this['_runtime']['releaseUnit'](_0x2d339e),this['_runtime']['disposeUnit'](_0x1f2d2c['unitID']),this['_reader']['unbind'](_0x1f2d2c['unitID']);}});});}['dispose'](){return this['_lifecycle']['dispose'](()=>this['_runtime']['dispose']());}},lr=class{['_bound']=new Map();['bind'](_0x55e85e){let _0x5a24e7;try{_0x5a24e7={'snapshot':structuredClone(_0x55e85e['snapshot']),'sheetBlocks':structuredClone(_0x55e85e['sheetBlocks']),'changesets':structuredClone(_0x55e85e['changesets']),'targetRevision':_0x55e85e['targetRevision']};}catch(_0x48d808){throw new C('INVALID_REQUEST','Materialization\x20input\x20must\x20be\x20structured-cloneable',{'cause':_0x48d808});}this['_bound']['set'](_0x5a24e7['snapshot']['unitID'],{'input':_0x5a24e7,'blocks':new Map(_0x5a24e7['sheetBlocks']['map'](_0x2aef1f=>[_0x2aef1f['id'],_0x2aef1f]))});}['unbind'](_0x592385){this['_bound']['delete'](_0x592385);}async['getUnit'](_0x1161b9,_0x3c12a0){let _0x18fe45=this['_bound']['get'](_0x3c12a0);return _0x18fe45?{'unitID':_0x3c12a0,'type':_0x18fe45['input']['snapshot']['type'],'headRevision':_0x18fe45['input']['targetRevision']}:null;}async['getSnapshot'](_0x1e79d9,_0x5ed7b0,_0x56bb62){let _0x4ef457=this['_bound']['get'](_0x5ed7b0),_0x52c764=_0x56bb62?.['revision']??_0x4ef457?.['input']['targetRevision'];return _0x4ef457&&_0x52c764!==void 0x0&&_0x4ef457['input']['snapshot']['rev']<=_0x52c764?_0x4ef457['input']['snapshot']:null;}async['getChangesets'](_0x58544b,_0x24c6dc,_0x141b3a){let _0x1f8e7b=this['_bound']['get'](_0x24c6dc);if(!_0x1f8e7b)return null;let _0x729f7=Math['min'](_0x141b3a['to']??_0x1f8e7b['input']['targetRevision'],_0x1f8e7b['input']['targetRevision']);return _0x1f8e7b['input']['changesets']['filter'](_0x5d7ca1=>_0x5d7ca1['revision']>_0x141b3a['from']&&_0x5d7ca1['revision']<=_0x729f7);}['getSheetBlock'](_0x212a10,_0x5e1be1,_0x50c13c){return Promise['resolve'](this['_require'](_0x5e1be1)['blocks']['get'](_0x50c13c)??null);}['_require'](_0x3593e2){let _0x314a5b=this['_bound']['get'](_0x3593e2);if(!_0x314a5b)throw new C('INTERNAL_ERROR','Materialization\x20data\x20for\x20Unit\x20'+_0x3593e2+'\x20is\x20unavailable',{'retryable':!0x0});return _0x314a5b;}};function ur(_0x38e429){if(!_0x38e429||typeof _0x38e429!='object'||!_0x38e429['snapshot'])throw $('Materialization\x20input\x20requires\x20a\x20snapshot');let {snapshot:_0x157476,targetRevision:_0x38ed08,changesets:_0x16d603,sheetBlocks:_0x314a9e}=_0x38e429;if(typeof _0x157476['unitID']!='string'||_0x157476['unitID']['length']===0x0||!Number['isSafeInteger'](_0x157476['rev'])||_0x157476['rev']<0x1||!Number['isSafeInteger'](_0x38ed08)||_0x38ed08<_0x157476['rev'])throw $('Materialization\x20revisions\x20are\x20invalid');if(!Array['isArray'](_0x16d603)||!Array['isArray'](_0x314a9e))throw $('Materialization\x20changesets\x20and\x20sheetBlocks\x20must\x20be\x20arrays');let _0x33b049=_0x157476['rev']+0x1;for(let _0x23db53 of _0x16d603){if(_0x23db53['unitID']!==_0x157476['unitID']||_0x23db53['type']!==_0x157476['type']||_0x23db53['baseRev']!==_0x33b049-0x1||_0x23db53['revision']!==_0x33b049)throw $('Materialization\x20changesets\x20are\x20not\x20contiguous');_0x33b049+=0x1;}if(_0x33b049-0x1!==_0x38ed08)throw $('Materialization\x20changesets\x20do\x20not\x20reach\x20targetRevision');let _0x1eedbe=new Map();for(let _0x4f1df4 of _0x314a9e){if(!_0x4f1df4||typeof _0x4f1df4['id']!='string'||_0x4f1df4['id']['length']===0x0||_0x1eedbe['has'](_0x4f1df4['id']))throw $('Materialization\x20Sheet\x20blocks\x20are\x20invalid');_0x1eedbe['set'](_0x4f1df4['id'],_0x4f1df4);}for(let _0x5211a1 of st(_0x157476))if(!_0x1eedbe['has'](_0x5211a1))throw $('Materialization\x20is\x20missing\x20Sheet\x20block\x20'+_0x5211a1);}function $(_0x1ae43c){return new C('INVALID_REQUEST',_0x1ae43c);}exports['CollabError']=C,exports['MAX_UNIT_LIFECYCLE_BATCH_SIZE']=Zn,exports['UnitSnapshotMaterializer']=cr,exports['UniverCollabService']=Qn,exports['createUnitRuntime']=K;