@univer-cli/unit-screenshot-command 1.5.2 → 1.6.0

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.
Files changed (2) hide show
  1. package/dist/index.mjs +1 -1
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- (function(_0x483b07,_0x44b85a){const _0x466220=_0x5e22,_0x53d419=_0x483b07();while(!![]){try{const _0x273633=-parseInt(_0x466220(0xec))/0x1*(parseInt(_0x466220(0x124))/0x2)+parseInt(_0x466220(0xde))/0x3*(parseInt(_0x466220(0x131))/0x4)+parseInt(_0x466220(0x129))/0x5*(-parseInt(_0x466220(0xfc))/0x6)+parseInt(_0x466220(0x12d))/0x7*(-parseInt(_0x466220(0xdd))/0x8)+parseInt(_0x466220(0xed))/0x9*(-parseInt(_0x466220(0x133))/0xa)+-parseInt(_0x466220(0x106))/0xb+-parseInt(_0x466220(0xd6))/0xc*(-parseInt(_0x466220(0xd3))/0xd);if(_0x273633===_0x44b85a)break;else _0x53d419['push'](_0x53d419['shift']());}catch(_0x4cbf8b){_0x53d419['push'](_0x53d419['shift']());}}}(_0x2a08,0x3debb));import{UnitScreenshotError as _0x5afbba}from'@univer-cli/unit-screenshot';import{Command as _0x2c9396}from'commander';import{installUniverRenderBrowser as _0xfecd48,probeUniverRenderBrowser as _0x549657,resolveUniverRenderBrowser as _0x2cb0a5}from'@univer-cli/univer-render-runtime';var a={'install':async()=>await _0xfecd48(),'probe':async _0x1b54b1=>await _0x549657(_0x1b54b1),'resolve':async()=>await _0x2cb0a5()};function _0x5e22(_0x348897,_0x2a4c59){_0x348897=_0x348897-0xce;const _0x2a086f=_0x2a08();let _0x5e22e3=_0x2a086f[_0x348897];return _0x5e22e3;}function o(_0x5edce8=a){const _0xb0f42b=_0x5e22;let _0x7a41ee=new _0x2c9396(_0xb0f42b(0x109))[_0xb0f42b(0x142)](_0xb0f42b(0x13e))[_0xb0f42b(0xee)](_0xb0f42b(0x110),_0xb0f42b(0xdc))[_0xb0f42b(0xee)](_0xb0f42b(0xff),_0xb0f42b(0x125));return _0x7a41ee['action'](async _0x5a71e2=>{const _0xae7c40=_0xb0f42b;l(_0x7a41ee);let _0x2a0d22={..._0x7a41ee[_0xae7c40(0x136)](),..._0x5a71e2},_0xc0e271;try{_0xc0e271=await s(_0x5edce8,_0x2a0d22[_0xae7c40(0x105)]===!0x0);}catch(_0x58065a){u(_0x58065a)&&_0x7a41ee[_0xae7c40(0x137)](_0x58065a[_0xae7c40(0xdf)]+':\x20'+_0x58065a['message'],{'code':_0xae7c40(0x116),'exitCode':0x1}),_0x7a41ee[_0xae7c40(0x137)](_0x58065a instanceof Error?_0x58065a[_0xae7c40(0xef)]:'Browser\x20setup\x20failed',{'code':_0xae7c40(0x116),'exitCode':0x1});}let _0x32cc3b=_0x2a0d22[_0xae7c40(0x101)]===!0x0?JSON[_0xae7c40(0xd4)]({'ok':!0x0,..._0xc0e271},null,0x2)+'\x0a':c(_0xc0e271);_0x7a41ee[_0xae7c40(0xfa)]()['writeOut']?.(_0x32cc3b);}),_0x7a41ee;}async function s(_0x1eb1e8,_0xb6e3cb){const _0x18f597=_0x5e22;if(!_0xb6e3cb){let _0x1280fa=await _0x1eb1e8[_0x18f597(0x120)]();if(_0x1280fa[_0x18f597(0x115)]==='found')return await _0x1eb1e8[_0x18f597(0xe4)]({'executablePath':_0x1280fa[_0x18f597(0xf4)]}),{'status':_0x18f597(0x113),'executablePath':_0x1280fa['executablePath'],'source':_0x1280fa[_0x18f597(0x10c)]};}let _0x58c763=await _0x1eb1e8[_0x18f597(0xe6)]();return await _0x1eb1e8['probe']({'executablePath':_0x58c763[_0x18f597(0xf4)]}),{'status':_0x18f597(0x123),..._0x58c763};}function c(_0x1a5408){const _0x51bab5=_0x5e22;return _0x1a5408['status']==='resolved'?[_0x51bab5(0x143)+_0x1a5408[_0x51bab5(0x10c)]+_0x51bab5(0xe1)+_0x1a5408[_0x51bab5(0xf4)],_0x51bab5(0xce),'']['join']('\x0a'):[_0x1a5408[_0x51bab5(0xe8)]?_0x51bab5(0x108)+_0x1a5408['executablePath']:_0x51bab5(0xe9)+_0x1a5408[_0x51bab5(0xf4)],_0x51bab5(0x14d)+_0x1a5408[_0x51bab5(0x148)],_0x51bab5(0x121)+_0x1a5408[_0x51bab5(0x122)],'']['join']('\x0a');}function l(_0xd5335b){const _0x2ff828=_0x5e22;_0xd5335b[_0x2ff828(0x107)]!==null&&_0xd5335b['configureOutput'](_0xd5335b[_0x2ff828(0x107)]['configureOutput']());}function u(_0x4cc054){const _0x14dca1=_0x5e22;return _0x4cc054 instanceof Error&&typeof _0x4cc054[_0x14dca1(0xdf)]==_0x14dca1(0x134);}var d=0x2710,f=class extends Error{constructor(_0x425e90){const _0x15bc57=_0x5e22;super(_0x425e90),this[_0x15bc57(0x111)]='UnitScreenshotCommandInputError';}};function p(_0x538863){const _0x40c46f=_0x5e22;let _0x25da1c=new _0x2c9396('screenshot')['description'](_0x40c46f(0x10a))['option'](_0x40c46f(0x127),_0x40c46f(0xd0))['option'](_0x40c46f(0xf5),_0x40c46f(0xeb))['option']('--contact-slide',_0x40c46f(0x130))[_0x40c46f(0xee)](_0x40c46f(0x144),_0x40c46f(0x119))['option'](_0x40c46f(0x12f),'Sheet\x20name\x20used\x20with\x20--range')[_0x40c46f(0xee)]('--range\x20<a1-range>',_0x40c46f(0x139))[_0x40c46f(0xee)](_0x40c46f(0x12e),_0x40c46f(0xe2))[_0x40c46f(0xee)](_0x40c46f(0x13c),_0x40c46f(0xd7))[_0x40c46f(0xee)](_0x40c46f(0xdb),'Board\x20content\x20padding')[_0x40c46f(0xee)](_0x40c46f(0x11e),_0x40c46f(0xfe))['option'](_0x40c46f(0xd8),'Opaque\x20output\x20destination\x20passed\x20to\x20the\x20writer')['option'](_0x40c46f(0xff),_0x40c46f(0xe5));return _0x25da1c['addCommand'](o(_0x538863[_0x40c46f(0x14c)])),_0x25da1c['action'](async _0x153145=>{const _0x444bab=_0x40c46f;let _0x598141;try{let _0x4fa48f=await _0x538863[_0x444bab(0xf7)](_0x153145['unit']===void 0x0?{}:{'unitId':_0x153145[_0x444bab(0x141)]});_0x598141=await m(_0x538863[_0x444bab(0xd9)],_0x4fa48f,_0x153145);}catch(_0x156754){C(_0x25da1c,_0x156754);}let _0x55b34c;try{_0x55b34c=await _0x538863[_0x444bab(0x13d)]({'result':_0x598141,..._0x153145[_0x444bab(0x11d)]===void 0x0?{}:{'destination':_0x153145[_0x444bab(0x11d)]}}),x(_0x598141,_0x55b34c);}catch(_0x43a937){C(_0x25da1c,_0x43a937);}let _0x88166b=_0x153145['json']===!0x0?JSON[_0x444bab(0xd4)](S(_0x598141,_0x55b34c),null,0x2)+'\x0a':_0x55b34c[_0x444bab(0xd2)](({location:_0x5b44de})=>_0x5b44de)['join']('\x0a')+'\x0a';_0x25da1c[_0x444bab(0xfa)]()[_0x444bab(0xea)]?.(_0x88166b);}),_0x25da1c;}async function m(_0x5a2097,_0x1e9be1,_0x130b75){const _0xbb46b8=_0x5e22;switch(_0x1e9be1[_0xbb46b8(0xf9)]){case'sheet':if(b(_0x130b75,['pages',_0xbb46b8(0x149),_0xbb46b8(0x138),_0xbb46b8(0x104),_0xbb46b8(0xd1),_0xbb46b8(0xf2),'scale'],_0xbb46b8(0x10e)),_0x130b75[_0xbb46b8(0xd5)]!==void 0x0&&_0x130b75['range']===void 0x0)throw new f(_0xbb46b8(0x102));return await _0x5a2097[_0xbb46b8(0x14b)]({..._0x1e9be1,..._0x130b75['range']===void 0x0?{}:{'target':{'kind':_0xbb46b8(0x11a),'range':_0x130b75[_0xbb46b8(0x12b)],..._0x130b75['sheet']===void 0x0?{}:{'sheetName':_0x130b75[_0xbb46b8(0xd5)]}}}});case _0xbb46b8(0x12a):return b(_0x130b75,[_0xbb46b8(0xf6),_0xbb46b8(0x149),_0xbb46b8(0x138),_0xbb46b8(0xd5),_0xbb46b8(0x12b),'region',_0xbb46b8(0xd1),_0xbb46b8(0xf2),_0xbb46b8(0x118)],_0xbb46b8(0x100)),await _0x5a2097[_0xbb46b8(0x14b)](_0x1e9be1);case _0xbb46b8(0x128):{if(b(_0x130b75,[_0xbb46b8(0xd5),_0xbb46b8(0x12b),_0xbb46b8(0x104),'elements',_0xbb46b8(0xf2),'scale'],'Slide'),_0x130b75[_0xbb46b8(0x138)]!==void 0x0&&_0x130b75[_0xbb46b8(0x149)]!==!0x0)throw new f(_0xbb46b8(0xf1));let _0x3684ec=h(_0x130b75['pages']),_0x58706e=g(_0x130b75['tile']);return await _0x5a2097[_0xbb46b8(0x14b)]({..._0x1e9be1,..._0x3684ec===void 0x0&&_0x130b75[_0xbb46b8(0x149)]!==!0x0?{}:{'target':{'kind':_0xbb46b8(0xfb),..._0x3684ec===void 0x0?{}:{'pages':_0x3684ec},..._0x130b75[_0xbb46b8(0x149)]===!0x0?{'contactSheet':_0x58706e===void 0x0?{}:{'tile':_0x58706e}}:{}}}});}case'board':{b(_0x130b75,[_0xbb46b8(0xf6),_0xbb46b8(0x149),_0xbb46b8(0x138),_0xbb46b8(0xd5),'range'],'Board');let _0x3ba6ae=_(_0x130b75[_0xbb46b8(0xd1)]),_0x454d79=v(_0x130b75[_0xbb46b8(0x104)]),_0x2dec85=y(_0xbb46b8(0x103),_0x130b75[_0xbb46b8(0xf2)]),_0x3a5477=y('--scale',_0x130b75['scale']);if(_0x3ba6ae!==void 0x0&&_0x454d79!==void 0x0)throw new f(_0xbb46b8(0xcf));if(_0x3ba6ae===void 0x0&&_0x454d79===void 0x0&&_0x3a5477!==void 0x0)throw new f('--scale\x20requires\x20--region\x20or\x20--elements');return await _0x5a2097[_0xbb46b8(0x14b)]({..._0x1e9be1,..._0x3ba6ae===void 0x0&&_0x454d79===void 0x0&&_0x2dec85===void 0x0&&_0x3a5477===void 0x0?{}:{'target':{'kind':_0xbb46b8(0xe3),..._0x3ba6ae===void 0x0?{}:{'elementIds':_0x3ba6ae},..._0x454d79===void 0x0?{}:{'region':_0x454d79},..._0x2dec85===void 0x0?{}:{'padding':_0x2dec85},..._0x3a5477===void 0x0?{}:{'scale':_0x3a5477}}}});}case'base':return b(_0x130b75,['pages','contactSlide',_0xbb46b8(0x138),_0xbb46b8(0xd5),_0xbb46b8(0x12b),'region',_0xbb46b8(0xd1),_0xbb46b8(0xf2),_0xbb46b8(0x118)],_0xbb46b8(0x117)),await _0x5a2097[_0xbb46b8(0x14b)](_0x1e9be1);}}function h(_0x477028){const _0x31ddd9=_0x5e22;if(_0x477028===void 0x0||_0x477028[_0x31ddd9(0x14a)]()===_0x31ddd9(0x112))return;if(_0x477028[_0x31ddd9(0x14a)]()['length']===0x0)throw new f('--pages\x20cannot\x20be\x20empty');let _0x349558=[];for(let _0x14e907 of _0x477028[_0x31ddd9(0x11c)](',')){let _0x425b06=_0x14e907['trim']();if(_0x425b06[_0x31ddd9(0x147)]===0x0)throw new f(_0x31ddd9(0xda));let _0x492c53=/^(\d+)(?:-(\d+))?$/['exec'](_0x425b06);if(_0x492c53===null){_0x349558['push'](_0x425b06);continue;}let _0x4c5952=Number(_0x492c53[0x1]),_0x3f2a07=Number(_0x492c53[0x2]??_0x492c53[0x1]);if(!Number['isSafeInteger'](_0x4c5952)||!Number[_0x31ddd9(0x132)](_0x3f2a07)||_0x4c5952<0x1||_0x3f2a07<_0x4c5952)throw new f('Invalid\x20--pages\x20range\x20'+JSON['stringify'](_0x14e907[_0x31ddd9(0x14a)]()));if(_0x3f2a07-_0x4c5952+0x1>d)throw new f(_0x31ddd9(0x13f)+d+_0x31ddd9(0xf0));for(let _0x1834e0=_0x4c5952;_0x1834e0<=_0x3f2a07;_0x1834e0+=0x1)_0x349558['push'](_0x1834e0);if(_0x349558[_0x31ddd9(0x147)]>d)throw new f(_0x31ddd9(0x146)+d+_0x31ddd9(0xf0));}return[...new Set(_0x349558)];}function g(_0x2e862d){const _0x526699=_0x5e22;if(_0x2e862d===void 0x0)return;let _0x5a40fb=/^(\d+)x(\d+)$/iu[_0x526699(0x12c)](_0x2e862d['trim']()),_0x12d2ab=Number(_0x5a40fb?.[0x1]),_0x28b2ba=Number(_0x5a40fb?.[0x2]);if(_0x5a40fb===null||!Number[_0x526699(0x132)](_0x12d2ab)||_0x12d2ab<0x1||!Number['isSafeInteger'](_0x28b2ba)||_0x28b2ba<0x1)throw new f(_0x526699(0x10b)+JSON[_0x526699(0xd4)](_0x2e862d)+';\x20expected\x20<columns>x<rows>');return{'columns':_0x12d2ab,'rows':_0x28b2ba};}function _(_0x27dcd1){const _0x5a8f8d=_0x5e22;if(_0x27dcd1===void 0x0)return;let _0x116ea7=[...new Set(_0x27dcd1[_0x5a8f8d(0x11c)](',')[_0x5a8f8d(0xd2)](_0xd2e13a=>_0xd2e13a[_0x5a8f8d(0x14a)]()))];if(_0x116ea7[_0x5a8f8d(0xf8)](_0x4a0b21=>_0x4a0b21[_0x5a8f8d(0x147)]===0x0))throw new f(_0x5a8f8d(0x13b));return _0x116ea7;}function v(_0x33cf63){const _0x91941=_0x5e22;if(_0x33cf63===void 0x0)return;let _0x45cdba=_0x33cf63[_0x91941(0x11c)](','),_0x2f22e3=_0x45cdba[_0x91941(0xd2)](Number);if(_0x45cdba['length']!==0x4||_0x45cdba[_0x91941(0xf8)](_0x2b3ba0=>_0x2b3ba0[_0x91941(0x14a)]()['length']===0x0)||_0x2f22e3[_0x91941(0x147)]!==0x4||!_0x2f22e3[_0x91941(0x126)](Number[_0x91941(0xe7)]))throw new f('--region\x20must\x20contain\x20left,top,width,height\x20as\x20finite\x20numbers');let [_0x34c7a2,_0x466877,_0x475452,_0x48a1b0]=_0x2f22e3;if(_0x475452<=0x0||_0x48a1b0<=0x0)throw new f(_0x91941(0x10d));return{'left':_0x34c7a2,'top':_0x466877,'width':_0x475452,'height':_0x48a1b0};}function y(_0x329477,_0x4a47e4){const _0x1acc13=_0x5e22;if(_0x4a47e4===void 0x0)return;if(_0x4a47e4[_0x1acc13(0x14a)]()[_0x1acc13(0x147)]===0x0)throw new f(_0x329477+'\x20must\x20be\x20a\x20finite\x20number');let _0x477aab=Number(_0x4a47e4);if(!Number['isFinite'](_0x477aab))throw new f(_0x329477+_0x1acc13(0x145));return _0x477aab;}function b(_0xec392d,_0x4ad780,_0x12cec5){const _0x2e3a70=_0x5e22;for(let _0x2363c4 of _0x4ad780)if(_0xec392d[_0x2363c4]!==void 0x0)throw new f('--'+_0x2363c4[_0x2e3a70(0x13a)](/[A-Z]/gu,_0x425782=>'-'+_0x425782[_0x2e3a70(0x10f)]())+_0x2e3a70(0x135)+_0x12cec5);}function x(_0x5bfdda,_0x115864){const _0x5874ca=_0x5e22;if(_0x115864[_0x5874ca(0x147)]!==_0x5bfdda['images'][_0x5874ca(0x147)])throw Error(_0x5874ca(0x140)+_0x115864[_0x5874ca(0x147)]+_0x5874ca(0xe0)+_0x5bfdda[_0x5874ca(0x11b)][_0x5874ca(0x147)]+_0x5874ca(0xf3));for(let _0x4987c9=0x0;_0x4987c9<_0x115864[_0x5874ca(0x147)];_0x4987c9+=0x1)if(_0x115864[_0x4987c9]?.[_0x5874ca(0x111)]!==_0x5bfdda[_0x5874ca(0x11b)][_0x4987c9]?.[_0x5874ca(0x111)])throw Error(_0x5874ca(0x11f)+(_0x4987c9+0x1)+'\x20does\x20not\x20match\x20the\x20captured\x20image\x20name');}function S(_0x2ab30d,_0x438360){const _0x43aafe=_0x5e22;return{'ok':!0x0,'unitId':_0x2ab30d['unitId'],'unitKind':_0x2ab30d['unitType'],'outputs':_0x2ab30d[_0x43aafe(0x11b)][_0x43aafe(0xd2)](({bytes:_0x37f4e5,..._0xc4bab1},_0x52d58a)=>({..._0xc4bab1,'location':_0x438360[_0x52d58a]['location']}))};}function C(_0x72bb42,_0x2510ae){const _0x1935b6=_0x5e22;_0x2510ae instanceof f&&_0x72bb42[_0x1935b6(0x137)](_0x2510ae[_0x1935b6(0xef)],{'code':'screenshot.invalid-input','exitCode':0x1}),(_0x2510ae instanceof _0x5afbba||w(_0x2510ae))&&_0x72bb42[_0x1935b6(0x137)](_0x2510ae[_0x1935b6(0xdf)]+':\x20'+_0x2510ae[_0x1935b6(0xef)],{'code':'screenshot.failed','exitCode':0x1}),_0x2510ae instanceof Error&&_0x72bb42['error'](_0x2510ae[_0x1935b6(0xef)],{'code':'screenshot.failed','exitCode':0x1}),_0x72bb42['error'](_0x1935b6(0xfd),{'code':_0x1935b6(0x114),'exitCode':0x1});}function w(_0x2baeab){const _0x2ec158=_0x5e22;return _0x2baeab instanceof Error&&typeof _0x2baeab[_0x2ec158(0xdf)]=='string';}export{f as UnitScreenshotCommandInputError,p as createUnitScreenshotCommand,o as createUniverRenderBrowserSetupCommand};function _0x2a08(){const _0x58d902=['\x20is\x20not\x20supported\x20for\x20','optsWithGlobals','error','tile','Sheet\x20range,\x20for\x20example\x20B2:H40','replace','--elements\x20must\x20contain\x20non-empty\x20IDs','--elements\x20<ids>','writeImages','Resolve\x20or\x20install\x20the\x20browser\x20used\x20for\x20Univer\x20rendering','A\x20--pages\x20range\x20cannot\x20exceed\x20','Screenshot\x20writer\x20returned\x20','unit','description','usable\x20browser\x20found\x20(','--tile\x20<columns>x<rows>','\x20must\x20be\x20a\x20finite\x20number','--pages\x20cannot\x20expand\x20to\x20more\x20than\x20','length','buildId','contactSlide','trim','capture','browserSetup','build:\x20','run\x20`screenshot\x20setup\x20--force`\x20to\x20ensure\x20the\x20pinned\x20Chromium\x20build','--elements\x20and\x20--region\x20cannot\x20be\x20used\x20together','Unit\x20to\x20capture','elements','map','1668004AJOFFQ','stringify','sheet','60IaSUQg','Board\x20element\x20IDs\x20separated\x20by\x20commas','--out\x20<destination>','screenshot','--pages\x20contains\x20an\x20empty\x20selector','--padding\x20<pixels>','skip\x20discovery\x20and\x20ensure\x20the\x20pinned\x20Chromium\x20build','6184lNdCRp','184323hxgXRz','code','\x20outputs\x20for\x20','):\x20','Board\x20region','board-content','probe','write\x20a\x20structured\x20output\x20summary\x20as\x20JSON','install','isFinite','alreadyInstalled','screenshot\x20browser\x20installed:\x20','writeOut','Slide\x20pages\x20or\x20page\x20IDs,\x20for\x20example\x201,3-5,cover','60107BtWLVg','153QELgcS','option','message','\x20pages','--tile\x20requires\x20--contact-slide','padding','\x20images','executablePath','--pages\x20<pages>','pages','loadUnit','some','unitType','configureOutput','slide-pages','1398dsuipw','Screenshot\x20failed','Board\x20selector\x20scale\x20between\x200.1\x20and\x204','--json','Doc','json','--sheet\x20requires\x20--range','--padding','region','force','2107281ZRUeax','parent','screenshot\x20browser\x20already\x20installed:\x20','setup','Render\x20a\x20Univer\x20Unit\x20as\x20PNG\x20images','Invalid\x20--tile\x20','source','--region\x20width\x20and\x20height\x20must\x20be\x20positive','Sheet','toLowerCase','--force','name','all','resolved','screenshot.failed','status','screenshot.setup-failed','Base','scale','Contact\x20slide\x20grid,\x20for\x20example\x204x2','sheet-range','images','split','out','--scale\x20<factor>','Screenshot\x20writer\x20output\x20','resolve','cache:\x20','cacheDir','installed','2CiVVgR','write\x20the\x20setup\x20result\x20as\x20JSON','every','--unit\x20<unit-id>','slide','5630sCPIgm','doc','range','exec','147VofkJR','--region\x20<left,top,width,height>','--sheet\x20<name>','Slide\x20overview\x20containing\x20all\x20captured\x20pages','20fpNukA','isSafeInteger','96970ocFaFe','string'];_0x2a08=function(){return _0x58d902;};return _0x2a08();}
1
+ (function(_0x53f16d,_0xeb52fd){const _0x135bf2=_0x7c57,_0x39e520=_0x53f16d();while(!![]){try{const _0x4ade63=-parseInt(_0x135bf2(0x16b))/0x1+-parseInt(_0x135bf2(0x18a))/0x2+-parseInt(_0x135bf2(0x122))/0x3*(parseInt(_0x135bf2(0x115))/0x4)+-parseInt(_0x135bf2(0x160))/0x5+parseInt(_0x135bf2(0x131))/0x6*(parseInt(_0x135bf2(0x10e))/0x7)+parseInt(_0x135bf2(0x10f))/0x8+parseInt(_0x135bf2(0x140))/0x9;if(_0x4ade63===_0xeb52fd)break;else _0x39e520['push'](_0x39e520['shift']());}catch(_0x47460c){_0x39e520['push'](_0x39e520['shift']());}}}(_0x2044,0xbd225));import{UnitScreenshotError as _0x4b3d5d}from'@univer-cli/unit-screenshot';import{Command as _0x5db5b8}from'commander';import{installUniverRenderBrowser as _0x4fa0eb,probeUniverRenderBrowser as _0xb6b791,resolveUniverRenderBrowser as _0x50f56b}from'@univer-cli/univer-render-runtime';var a={'install':async()=>await _0x4fa0eb(),'probe':async _0x28cef6=>await _0xb6b791(_0x28cef6),'resolve':async()=>await _0x50f56b()};function o(_0x10228e=a){const _0x316184=_0x7c57;let _0xba36a9=new _0x5db5b8(_0x316184(0x13d))[_0x316184(0x116)](_0x316184(0x16e))['option'](_0x316184(0x16a),_0x316184(0x139))[_0x316184(0x13e)](_0x316184(0x161),'write\x20the\x20setup\x20result\x20as\x20JSON');return _0xba36a9['action'](async _0x591def=>{const _0x3be2c4=_0x316184;l(_0xba36a9);let _0x412284={..._0xba36a9[_0x3be2c4(0x16f)](),..._0x591def},_0x1d95fd;try{_0x1d95fd=await s(_0x10228e,_0x412284[_0x3be2c4(0x14d)]===!0x0);}catch(_0x12e738){u(_0x12e738)&&_0xba36a9['error'](_0x12e738['code']+':\x20'+_0x12e738[_0x3be2c4(0x147)],{'code':'screenshot.setup-failed','exitCode':0x1}),_0xba36a9['error'](_0x12e738 instanceof Error?_0x12e738[_0x3be2c4(0x147)]:'Browser\x20setup\x20failed',{'code':_0x3be2c4(0x15d),'exitCode':0x1});}let _0x55258a=_0x412284[_0x3be2c4(0x130)]===!0x0?JSON[_0x3be2c4(0x154)]({'ok':!0x0,..._0x1d95fd},null,0x2)+'\x0a':c(_0x1d95fd);_0xba36a9[_0x3be2c4(0x178)]()[_0x3be2c4(0x13f)]?.(_0x55258a);}),_0xba36a9;}async function s(_0x5e1b1f,_0x45752d){const _0x23750c=_0x7c57;if(!_0x45752d){let _0x8016b4=await _0x5e1b1f[_0x23750c(0x113)]();if(_0x8016b4[_0x23750c(0x171)]===_0x23750c(0x152))return await _0x5e1b1f[_0x23750c(0x146)]({'executablePath':_0x8016b4[_0x23750c(0x143)]}),{'status':'resolved','executablePath':_0x8016b4[_0x23750c(0x143)],'source':_0x8016b4['source']};}let _0x1ad8e9=await _0x5e1b1f[_0x23750c(0x185)]();return await _0x5e1b1f[_0x23750c(0x146)]({'executablePath':_0x1ad8e9[_0x23750c(0x143)]}),{'status':'installed',..._0x1ad8e9};}function c(_0x118bb1){const _0x6498f2=_0x7c57;return _0x118bb1[_0x6498f2(0x171)]===_0x6498f2(0x14f)?[_0x6498f2(0x11c)+_0x118bb1[_0x6498f2(0x138)]+_0x6498f2(0x180)+_0x118bb1[_0x6498f2(0x143)],'run\x20`screenshot\x20setup\x20--force`\x20to\x20ensure\x20the\x20pinned\x20Chromium\x20build',''][_0x6498f2(0x165)]('\x0a'):[_0x118bb1[_0x6498f2(0x179)]?_0x6498f2(0x11a)+_0x118bb1[_0x6498f2(0x143)]:_0x6498f2(0x187)+_0x118bb1[_0x6498f2(0x143)],_0x6498f2(0x135)+_0x118bb1[_0x6498f2(0x114)],_0x6498f2(0x184)+_0x118bb1[_0x6498f2(0x166)],'']['join']('\x0a');}function l(_0x332f64){const _0x137e40=_0x7c57;_0x332f64[_0x137e40(0x17d)]!==null&&_0x332f64[_0x137e40(0x178)](_0x332f64['parent'][_0x137e40(0x178)]());}function u(_0x1cd9b){const _0x15c321=_0x7c57;return _0x1cd9b instanceof Error&&typeof _0x1cd9b[_0x15c321(0x11d)]==_0x15c321(0x13b);}var d=0x2710,f=class extends Error{constructor(_0x18bcde){const _0x44f6b9=_0x7c57;super(_0x18bcde),this[_0x44f6b9(0x118)]=_0x44f6b9(0x144);}};function p(_0x5dc3cb){const _0x34f9b0=_0x7c57;let _0x49c66e=new _0x5db5b8(_0x34f9b0(0x156))[_0x34f9b0(0x116)]('Render\x20a\x20Univer\x20Unit\x20as\x20PNG\x20images')[_0x34f9b0(0x13e)]('--unit\x20<unit-id>',_0x34f9b0(0x12b))[_0x34f9b0(0x13e)](_0x34f9b0(0x151),_0x34f9b0(0x14c))['option'](_0x34f9b0(0x111),_0x34f9b0(0x158))[_0x34f9b0(0x13e)]('--tile\x20<columns>x<rows>','Contact\x20slide\x20grid,\x20for\x20example\x204x2')[_0x34f9b0(0x13e)](_0x34f9b0(0x188),'Sheet\x20name\x20used\x20with\x20--range')[_0x34f9b0(0x13e)](_0x34f9b0(0x132),'Sheet\x20range,\x20for\x20example\x20B2:H40')['option'](_0x34f9b0(0x155),_0x34f9b0(0x177))[_0x34f9b0(0x13e)]('--elements\x20<ids>',_0x34f9b0(0x172))[_0x34f9b0(0x13e)](_0x34f9b0(0x169),'Board\x20content\x20padding')['option'](_0x34f9b0(0x183),_0x34f9b0(0x10d))[_0x34f9b0(0x13e)]('--out\x20<destination>','Opaque\x20output\x20destination\x20passed\x20to\x20the\x20writer')[_0x34f9b0(0x13e)](_0x34f9b0(0x161),_0x34f9b0(0x128));return _0x49c66e['addCommand'](o(_0x5dc3cb[_0x34f9b0(0x167)])),_0x49c66e['action'](async _0x582a92=>{const _0x57819d=_0x34f9b0;let _0x2d528e;try{let _0x19f595=await _0x5dc3cb[_0x57819d(0x14b)](_0x582a92[_0x57819d(0x181)]===void 0x0?{}:{'unitId':_0x582a92[_0x57819d(0x181)]});_0x2d528e=await m(_0x5dc3cb[_0x57819d(0x156)],_0x19f595,_0x582a92);}catch(_0x2f27a2){C(_0x49c66e,_0x2f27a2);}let _0x2cfc79;try{_0x2cfc79=await _0x5dc3cb[_0x57819d(0x121)]({'result':_0x2d528e,..._0x582a92['out']===void 0x0?{}:{'destination':_0x582a92[_0x57819d(0x153)]}}),x(_0x2d528e,_0x2cfc79);}catch(_0xd6fef2){C(_0x49c66e,_0xd6fef2);}let _0x10e163=_0x582a92[_0x57819d(0x130)]===!0x0?JSON['stringify'](S(_0x2d528e,_0x2cfc79),null,0x2)+'\x0a':_0x2cfc79['map'](({location:_0x4407a9})=>_0x4407a9)[_0x57819d(0x165)]('\x0a')+'\x0a';_0x49c66e['configureOutput']()[_0x57819d(0x13f)]?.(_0x10e163);}),_0x49c66e;}async function m(_0x27906f,_0x2f2c63,_0x12ea69){const _0x3310ed=_0x7c57;switch(_0x2f2c63[_0x3310ed(0x117)]){case'sheet':if(b(_0x12ea69,[_0x3310ed(0x168),_0x3310ed(0x17a),_0x3310ed(0x112),'region','elements',_0x3310ed(0x134),_0x3310ed(0x149)],_0x3310ed(0x141)),_0x12ea69[_0x3310ed(0x12c)]!==void 0x0&&_0x12ea69[_0x3310ed(0x12d)]===void 0x0)throw new f(_0x3310ed(0x15a));return await _0x27906f[_0x3310ed(0x11b)]({..._0x2f2c63,..._0x12ea69[_0x3310ed(0x12d)]===void 0x0?{}:{'target':{'kind':_0x3310ed(0x15e),'range':_0x12ea69[_0x3310ed(0x12d)],..._0x12ea69[_0x3310ed(0x12c)]===void 0x0?{}:{'sheetName':_0x12ea69[_0x3310ed(0x12c)]}}}});case _0x3310ed(0x174):return b(_0x12ea69,[_0x3310ed(0x168),_0x3310ed(0x17a),_0x3310ed(0x112),'sheet','range',_0x3310ed(0x173),_0x3310ed(0x145),_0x3310ed(0x134),_0x3310ed(0x149)],'Doc'),await _0x27906f[_0x3310ed(0x11b)](_0x2f2c63);case'slide':{if(b(_0x12ea69,[_0x3310ed(0x12c),_0x3310ed(0x12d),_0x3310ed(0x173),_0x3310ed(0x145),_0x3310ed(0x134),_0x3310ed(0x149)],_0x3310ed(0x162)),_0x12ea69['tile']!==void 0x0&&_0x12ea69[_0x3310ed(0x17a)]!==!0x0)throw new f(_0x3310ed(0x15b));let _0x1001f0=h(_0x12ea69[_0x3310ed(0x168)]),_0x346ff2=g(_0x12ea69[_0x3310ed(0x112)]);return await _0x27906f[_0x3310ed(0x11b)]({..._0x2f2c63,..._0x1001f0===void 0x0&&_0x12ea69['contactSlide']!==!0x0?{}:{'target':{'kind':_0x3310ed(0x142),..._0x1001f0===void 0x0?{}:{'pages':_0x1001f0},..._0x12ea69[_0x3310ed(0x17a)]===!0x0?{'contactSheet':_0x346ff2===void 0x0?{}:{'tile':_0x346ff2}}:{}}}});}case _0x3310ed(0x159):{b(_0x12ea69,['pages','contactSlide',_0x3310ed(0x112),_0x3310ed(0x12c),_0x3310ed(0x12d)],_0x3310ed(0x150));let _0x48d4ae=_(_0x12ea69['elements']),_0xc33587=v(_0x12ea69[_0x3310ed(0x173)]),_0x2ef4f3=y('--padding',_0x12ea69['padding']),_0xbf7df2=y(_0x3310ed(0x17b),_0x12ea69['scale']);if(_0x48d4ae!==void 0x0&&_0xc33587!==void 0x0)throw new f(_0x3310ed(0x13a));if(_0x48d4ae===void 0x0&&_0xc33587===void 0x0&&_0xbf7df2!==void 0x0)throw new f(_0x3310ed(0x189));return await _0x27906f[_0x3310ed(0x11b)]({..._0x2f2c63,..._0x48d4ae===void 0x0&&_0xc33587===void 0x0&&_0x2ef4f3===void 0x0&&_0xbf7df2===void 0x0?{}:{'target':{'kind':_0x3310ed(0x15f),..._0x48d4ae===void 0x0?{}:{'elementIds':_0x48d4ae},..._0xc33587===void 0x0?{}:{'region':_0xc33587},..._0x2ef4f3===void 0x0?{}:{'padding':_0x2ef4f3},..._0xbf7df2===void 0x0?{}:{'scale':_0xbf7df2}}}});}case _0x3310ed(0x126):return b(_0x12ea69,[_0x3310ed(0x168),_0x3310ed(0x17a),_0x3310ed(0x112),_0x3310ed(0x12c),_0x3310ed(0x12d),_0x3310ed(0x173),_0x3310ed(0x145),_0x3310ed(0x134),_0x3310ed(0x149)],_0x3310ed(0x182)),await _0x27906f[_0x3310ed(0x11b)](_0x2f2c63);}}function h(_0x1581d6){const _0x4f4f0d=_0x7c57;if(_0x1581d6===void 0x0||_0x1581d6[_0x4f4f0d(0x14e)]()==='all')return;if(_0x1581d6[_0x4f4f0d(0x14e)]()[_0x4f4f0d(0x15c)]===0x0)throw new f(_0x4f4f0d(0x12a));let _0x5b1925=[];for(let _0x25571d of _0x1581d6['split'](',')){let _0xd449c5=_0x25571d['trim']();if(_0xd449c5[_0x4f4f0d(0x15c)]===0x0)throw new f(_0x4f4f0d(0x17f));let _0x1b6bd9=/^(\d+)(?:-(\d+))?$/[_0x4f4f0d(0x125)](_0xd449c5);if(_0x1b6bd9===null){_0x5b1925[_0x4f4f0d(0x127)](_0xd449c5);continue;}let _0x3f3867=Number(_0x1b6bd9[0x1]),_0x45f950=Number(_0x1b6bd9[0x2]??_0x1b6bd9[0x1]);if(!Number['isSafeInteger'](_0x3f3867)||!Number[_0x4f4f0d(0x176)](_0x45f950)||_0x3f3867<0x1||_0x45f950<_0x3f3867)throw new f(_0x4f4f0d(0x133)+JSON['stringify'](_0x25571d['trim']()));if(_0x45f950-_0x3f3867+0x1>d)throw new f(_0x4f4f0d(0x120)+d+'\x20pages');for(let _0x311af9=_0x3f3867;_0x311af9<=_0x45f950;_0x311af9+=0x1)_0x5b1925['push'](_0x311af9);if(_0x5b1925[_0x4f4f0d(0x15c)]>d)throw new f(_0x4f4f0d(0x11e)+d+_0x4f4f0d(0x186));}return[...new Set(_0x5b1925)];}function g(_0x234e44){const _0x2627e5=_0x7c57;if(_0x234e44===void 0x0)return;let _0x38383e=/^(\d+)x(\d+)$/iu['exec'](_0x234e44[_0x2627e5(0x14e)]()),_0x4c7d18=Number(_0x38383e?.[0x1]),_0x46efb1=Number(_0x38383e?.[0x2]);if(_0x38383e===null||!Number[_0x2627e5(0x176)](_0x4c7d18)||_0x4c7d18<0x1||!Number['isSafeInteger'](_0x46efb1)||_0x46efb1<0x1)throw new f(_0x2627e5(0x11f)+JSON[_0x2627e5(0x154)](_0x234e44)+_0x2627e5(0x157));return{'columns':_0x4c7d18,'rows':_0x46efb1};}function _(_0x23e76f){const _0x586acf=_0x7c57;if(_0x23e76f===void 0x0)return;let _0x52e9bc=[...new Set(_0x23e76f[_0x586acf(0x119)](',')[_0x586acf(0x170)](_0x34b94a=>_0x34b94a[_0x586acf(0x14e)]()))];if(_0x52e9bc[_0x586acf(0x17c)](_0x2a9097=>_0x2a9097['length']===0x0))throw new f(_0x586acf(0x16d));return _0x52e9bc;}function _0x2044(){const _0x21d2ae=['Board\x20element\x20IDs\x20separated\x20by\x20commas','region','doc','Screenshot\x20failed','isSafeInteger','Board\x20region','configureOutput','alreadyInstalled','contactSlide','--scale','some','parent','isFinite','--pages\x20contains\x20an\x20empty\x20selector','):\x20','unit','Base','--scale\x20<factor>','cache:\x20','install','\x20pages','screenshot\x20browser\x20installed:\x20','--sheet\x20<name>','--scale\x20requires\x20--region\x20or\x20--elements','2364862kammiA','Board\x20selector\x20scale\x20between\x200.1\x20and\x204','7WgEtTd','7222424avaQAn','location','--contact-slide','tile','resolve','buildId','5763624OlwDhF','description','unitType','name','split','screenshot\x20browser\x20already\x20installed:\x20','capture','usable\x20browser\x20found\x20(','code','--pages\x20cannot\x20expand\x20to\x20more\x20than\x20','Invalid\x20--tile\x20','A\x20--pages\x20range\x20cannot\x20exceed\x20','writeImages','3SxYjSa','\x20must\x20be\x20a\x20finite\x20number','toLowerCase','exec','base','push','write\x20a\x20structured\x20output\x20summary\x20as\x20JSON','screenshot.invalid-input','--pages\x20cannot\x20be\x20empty','Unit\x20to\x20capture','sheet','range','Screenshot\x20writer\x20returned\x20','--region\x20must\x20contain\x20left,top,width,height\x20as\x20finite\x20numbers','json','5606184DpoXnZ','--range\x20<a1-range>','Invalid\x20--pages\x20range\x20','padding','build:\x20','screenshot.failed','\x20does\x20not\x20match\x20the\x20captured\x20image\x20name','source','skip\x20discovery\x20and\x20ensure\x20the\x20pinned\x20Chromium\x20build','--elements\x20and\x20--region\x20cannot\x20be\x20used\x20together','string','Screenshot\x20writer\x20output\x20','setup','option','writeOut','23360400tgxHoP','Sheet','slide-pages','executablePath','UnitScreenshotCommandInputError','elements','probe','message','unitId','scale','images','loadUnit','Slide\x20pages\x20or\x20page\x20IDs,\x20for\x20example\x201,3-5,cover','force','trim','resolved','Board','--pages\x20<pages>','found','out','stringify','--region\x20<left,top,width,height>','screenshot',';\x20expected\x20<columns>x<rows>','Slide\x20overview\x20containing\x20all\x20captured\x20pages','board','--sheet\x20requires\x20--range','--tile\x20requires\x20--contact-slide','length','screenshot.setup-failed','sheet-range','board-content','451885PKpkUf','--json','Slide','\x20is\x20not\x20supported\x20for\x20','replace','join','cacheDir','browserSetup','pages','--padding\x20<pixels>','--force','944360lFoaae','error','--elements\x20must\x20contain\x20non-empty\x20IDs','Resolve\x20or\x20install\x20the\x20browser\x20used\x20for\x20Univer\x20rendering','optsWithGlobals','map','status'];_0x2044=function(){return _0x21d2ae;};return _0x2044();}function v(_0x3c87b4){const _0x7a2775=_0x7c57;if(_0x3c87b4===void 0x0)return;let _0x539e14=_0x3c87b4[_0x7a2775(0x119)](','),_0x148b63=_0x539e14[_0x7a2775(0x170)](Number);if(_0x539e14[_0x7a2775(0x15c)]!==0x4||_0x539e14[_0x7a2775(0x17c)](_0x28bea2=>_0x28bea2[_0x7a2775(0x14e)]()[_0x7a2775(0x15c)]===0x0)||_0x148b63['length']!==0x4||!_0x148b63['every'](Number[_0x7a2775(0x17e)]))throw new f(_0x7a2775(0x12f));let [_0x3cf262,_0x4dc784,_0x1c678d,_0x38489e]=_0x148b63;if(_0x1c678d<=0x0||_0x38489e<=0x0)throw new f('--region\x20width\x20and\x20height\x20must\x20be\x20positive');return{'left':_0x3cf262,'top':_0x4dc784,'width':_0x1c678d,'height':_0x38489e};}function y(_0x41875c,_0x3f7616){const _0x43e560=_0x7c57;if(_0x3f7616===void 0x0)return;if(_0x3f7616[_0x43e560(0x14e)]()[_0x43e560(0x15c)]===0x0)throw new f(_0x41875c+_0x43e560(0x123));let _0x55d6ee=Number(_0x3f7616);if(!Number[_0x43e560(0x17e)](_0x55d6ee))throw new f(_0x41875c+'\x20must\x20be\x20a\x20finite\x20number');return _0x55d6ee;}function _0x7c57(_0x349ef3,_0x40ed77){_0x349ef3=_0x349ef3-0x10d;const _0x204475=_0x2044();let _0x7c571a=_0x204475[_0x349ef3];return _0x7c571a;}function b(_0x2addaa,_0x1cfc9f,_0x360373){const _0x22d2e1=_0x7c57;for(let _0x404f8b of _0x1cfc9f)if(_0x2addaa[_0x404f8b]!==void 0x0)throw new f('--'+_0x404f8b[_0x22d2e1(0x164)](/[A-Z]/gu,_0x5a0b8f=>'-'+_0x5a0b8f[_0x22d2e1(0x124)]())+_0x22d2e1(0x163)+_0x360373);}function x(_0x340969,_0x3ea2f5){const _0x4e2eb5=_0x7c57;if(_0x3ea2f5['length']!==_0x340969[_0x4e2eb5(0x14a)][_0x4e2eb5(0x15c)])throw Error(_0x4e2eb5(0x12e)+_0x3ea2f5[_0x4e2eb5(0x15c)]+'\x20outputs\x20for\x20'+_0x340969[_0x4e2eb5(0x14a)][_0x4e2eb5(0x15c)]+'\x20images');for(let _0x2876ad=0x0;_0x2876ad<_0x3ea2f5[_0x4e2eb5(0x15c)];_0x2876ad+=0x1)if(_0x3ea2f5[_0x2876ad]?.[_0x4e2eb5(0x118)]!==_0x340969['images'][_0x2876ad]?.['name'])throw Error(_0x4e2eb5(0x13c)+(_0x2876ad+0x1)+_0x4e2eb5(0x137));}function S(_0x530cf8,_0x586192){const _0x4f3293=_0x7c57;return{'ok':!0x0,'unitId':_0x530cf8[_0x4f3293(0x148)],'unitKind':_0x530cf8[_0x4f3293(0x117)],'outputs':_0x530cf8[_0x4f3293(0x14a)][_0x4f3293(0x170)](({bytes:_0x29cdef,..._0x2abc3d},_0x3cb81c)=>({..._0x2abc3d,'location':_0x586192[_0x3cb81c][_0x4f3293(0x110)]}))};}function C(_0x5e8c8b,_0x2062f9){const _0x38c495=_0x7c57;_0x2062f9 instanceof f&&_0x5e8c8b[_0x38c495(0x16c)](_0x2062f9[_0x38c495(0x147)],{'code':_0x38c495(0x129),'exitCode':0x1}),(_0x2062f9 instanceof _0x4b3d5d||w(_0x2062f9))&&_0x5e8c8b[_0x38c495(0x16c)](_0x2062f9[_0x38c495(0x11d)]+':\x20'+_0x2062f9[_0x38c495(0x147)],{'code':_0x38c495(0x136),'exitCode':0x1}),_0x2062f9 instanceof Error&&_0x5e8c8b[_0x38c495(0x16c)](_0x2062f9['message'],{'code':_0x38c495(0x136),'exitCode':0x1}),_0x5e8c8b['error'](_0x38c495(0x175),{'code':_0x38c495(0x136),'exitCode':0x1});}function w(_0xbb870b){const _0x130dc=_0x7c57;return _0xbb870b instanceof Error&&typeof _0xbb870b['code']==_0x130dc(0x13b);}export{f as UnitScreenshotCommandInputError,p as createUnitScreenshotCommand,o as createUniverRenderBrowserSetupCommand};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@univer-cli/unit-screenshot-command",
3
3
  "type": "module",
4
- "version": "1.5.2",
4
+ "version": "1.6.0",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
@@ -18,8 +18,8 @@
18
18
  "README.zh-CN.md"
19
19
  ],
20
20
  "dependencies": {
21
- "@univer-cli/unit-screenshot": "1.5.2",
22
- "@univer-cli/univer-render-runtime": "1.5.2"
21
+ "@univer-cli/unit-screenshot": "1.6.0",
22
+ "@univer-cli/univer-render-runtime": "1.6.0"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "commander": "^15.0.0"