@univer-cli/unit-screenshot-command 1.3.0 → 1.4.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.
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x83f29c,_0x471707){const _0x41f906=_0x490b,_0x4fbb5c=_0x83f29c();while(!![]){try{const _0x37b9ff=parseInt(_0x41f906(0x84))/0x1*(parseInt(_0x41f906(0xe3))/0x2)+-parseInt(_0x41f906(0xa7))/0x3*(-parseInt(_0x41f906(0xaf))/0x4)+parseInt(_0x41f906(0x6a))/0x5*(-parseInt(_0x41f906(0xd9))/0x6)+parseInt(_0x41f906(0xcb))/0x7+parseInt(_0x41f906(0xba))/0x8+parseInt(_0x41f906(0xaa))/0x9*(-parseInt(_0x41f906(0x90))/0xa)+-parseInt(_0x41f906(0x71))/0xb;if(_0x37b9ff===_0x471707)break;else _0x4fbb5c['push'](_0x4fbb5c['shift']());}catch(_0x4980d9){_0x4fbb5c['push'](_0x4fbb5c['shift']());}}}(_0x259d,0x5d627));import{UnitScreenshotError as _0x49b088}from'@univer-cli/unit-screenshot';function _0x490b(_0x4b3a85,_0x355b83){_0x4b3a85=_0x4b3a85-0x67;const _0x259d3f=_0x259d();let _0x490bdc=_0x259d3f[_0x4b3a85];return _0x490bdc;}import{Command as _0x25075f}from'commander';import{installUniverRenderBrowser as _0xe79b50,probeUniverRenderBrowser as _0x2c2b9a,resolveUniverRenderBrowser as _0x16dba0}from'@univer-cli/univer-render-runtime';var a={'install':async()=>await _0xe79b50(),'probe':async _0x1ca9e7=>await _0x2c2b9a(_0x1ca9e7),'resolve':async()=>await _0x16dba0()};function o(_0x396265=a){const _0x525988=_0x490b;let _0x1313a1=new _0x25075f('setup')[_0x525988(0x8f)]('Resolve\x20or\x20install\x20the\x20browser\x20used\x20for\x20Univer\x20rendering')[_0x525988(0x94)]('--force',_0x525988(0xde))[_0x525988(0x94)](_0x525988(0xd0),'write\x20the\x20setup\x20result\x20as\x20JSON');return _0x1313a1[_0x525988(0xc3)](async _0xc57449=>{const _0x1cc176=_0x525988;l(_0x1313a1);let _0x5812e2={..._0x1313a1[_0x1cc176(0xb1)](),..._0xc57449},_0x1972e0;try{_0x1972e0=await s(_0x396265,_0x5812e2[_0x1cc176(0x8a)]===!0x0);}catch(_0x17538f){u(_0x17538f)&&_0x1313a1['error'](_0x17538f[_0x1cc176(0xd4)]+':\x20'+_0x17538f[_0x1cc176(0x68)],{'code':_0x1cc176(0xc4),'exitCode':0x1}),_0x1313a1[_0x1cc176(0x9e)](_0x17538f instanceof Error?_0x17538f['message']:_0x1cc176(0x77),{'code':_0x1cc176(0xc4),'exitCode':0x1});}let _0x16da66=_0x5812e2[_0x1cc176(0xa0)]===!0x0?JSON[_0x1cc176(0xc1)]({'ok':!0x0,..._0x1972e0},null,0x2)+'\x0a':c(_0x1972e0);_0x1313a1[_0x1cc176(0x7d)]()['writeOut']?.(_0x16da66);}),_0x1313a1;}async function s(_0x15679e,_0x376662){const _0x5bb3f0=_0x490b;if(!_0x376662){let _0xd4c9e6=await _0x15679e[_0x5bb3f0(0xab)]();if(_0xd4c9e6[_0x5bb3f0(0xe2)]===_0x5bb3f0(0x80))return await _0x15679e[_0x5bb3f0(0x99)]({'executablePath':_0xd4c9e6[_0x5bb3f0(0x72)]}),{'status':'resolved','executablePath':_0xd4c9e6['executablePath'],'source':_0xd4c9e6[_0x5bb3f0(0x98)]};}let _0x2be9d7=await _0x15679e[_0x5bb3f0(0xd5)]();return await _0x15679e['probe']({'executablePath':_0x2be9d7[_0x5bb3f0(0x72)]}),{'status':'installed',..._0x2be9d7};}function c(_0x3a1da8){const _0x9eb574=_0x490b;return _0x3a1da8[_0x9eb574(0xe2)]===_0x9eb574(0x6b)?[_0x9eb574(0xd2)+_0x3a1da8[_0x9eb574(0x98)]+_0x9eb574(0xa1)+_0x3a1da8[_0x9eb574(0x72)],_0x9eb574(0x7a),''][_0x9eb574(0xdd)]('\x0a'):[_0x3a1da8[_0x9eb574(0xc0)]?_0x9eb574(0xa5)+_0x3a1da8[_0x9eb574(0x72)]:_0x9eb574(0x73)+_0x3a1da8[_0x9eb574(0x72)],_0x9eb574(0xbb)+_0x3a1da8['buildId'],_0x9eb574(0x7f)+_0x3a1da8[_0x9eb574(0x9f)],''][_0x9eb574(0xdd)]('\x0a');}function l(_0x5d2a33){const _0x268479=_0x490b;_0x5d2a33[_0x268479(0xb2)]!==null&&_0x5d2a33[_0x268479(0x7d)](_0x5d2a33['parent']['configureOutput']());}function u(_0x1201d4){return _0x1201d4 instanceof Error&&typeof _0x1201d4['code']=='string';}var d=0x2710,f=class extends Error{constructor(_0x2cd16f){const _0x751f6f=_0x490b;super(_0x2cd16f),this[_0x751f6f(0x9d)]='UnitScreenshotCommandInputError';}};function p(_0x12f87f){const _0x6212db=_0x490b;let _0x128951=new _0x25075f(_0x6212db(0x8d))['description'](_0x6212db(0xda))['option'](_0x6212db(0x9b),'Unit\x20to\x20capture')['option'](_0x6212db(0xa2),_0x6212db(0x7c))[_0x6212db(0x94)]('--contact-slide',_0x6212db(0xb7))[_0x6212db(0x94)](_0x6212db(0xc7),_0x6212db(0x88))[_0x6212db(0x94)]('--sheet\x20<name>',_0x6212db(0x8e))[_0x6212db(0x94)]('--range\x20<a1-range>',_0x6212db(0xdc))[_0x6212db(0x94)](_0x6212db(0xc8),'Board\x20region')[_0x6212db(0x94)](_0x6212db(0x6f),_0x6212db(0x70))[_0x6212db(0x94)]('--padding\x20<pixels>',_0x6212db(0x97))[_0x6212db(0x94)](_0x6212db(0xc5),_0x6212db(0xa8))[_0x6212db(0x94)]('--out\x20<destination>',_0x6212db(0x78))[_0x6212db(0x94)](_0x6212db(0xd0),_0x6212db(0x9a));return _0x128951['addCommand'](o(_0x12f87f['browserSetup'])),_0x128951['action'](async _0x52a9be=>{const _0x3ad734=_0x6212db;let _0x4d8fd5;try{let _0x42a2b0=await _0x12f87f['loadUnit'](_0x52a9be[_0x3ad734(0xdb)]===void 0x0?{}:{'unitId':_0x52a9be['unit']});_0x4d8fd5=await m(_0x12f87f['screenshot'],_0x42a2b0,_0x52a9be);}catch(_0x5693c5){C(_0x128951,_0x5693c5);}let _0x4944e4;try{_0x4944e4=await _0x12f87f[_0x3ad734(0x69)]({'result':_0x4d8fd5,..._0x52a9be[_0x3ad734(0xa4)]===void 0x0?{}:{'destination':_0x52a9be[_0x3ad734(0xa4)]}}),x(_0x4d8fd5,_0x4944e4);}catch(_0x961d67){C(_0x128951,_0x961d67);}let _0x10501b=_0x52a9be[_0x3ad734(0xa0)]===!0x0?JSON[_0x3ad734(0xc1)](S(_0x4d8fd5,_0x4944e4),null,0x2)+'\x0a':_0x4944e4[_0x3ad734(0x7b)](({location:_0x4a3777})=>_0x4a3777)[_0x3ad734(0xdd)]('\x0a')+'\x0a';_0x128951['configureOutput']()[_0x3ad734(0xac)]?.(_0x10501b);}),_0x128951;}async function m(_0x153909,_0x21a07e,_0x31cc01){const _0x44b857=_0x490b;switch(_0x21a07e[_0x44b857(0xe0)]){case _0x44b857(0xcc):if(b(_0x31cc01,[_0x44b857(0x8b),'contactSlide',_0x44b857(0x76),_0x44b857(0xbc),_0x44b857(0xc2),'padding',_0x44b857(0x67)],_0x44b857(0x75)),_0x31cc01[_0x44b857(0xcc)]!==void 0x0&&_0x31cc01[_0x44b857(0xae)]===void 0x0)throw new f(_0x44b857(0xd7));return await _0x153909[_0x44b857(0xce)]({..._0x21a07e,..._0x31cc01[_0x44b857(0xae)]===void 0x0?{}:{'target':{'kind':_0x44b857(0xd8),'range':_0x31cc01['range'],..._0x31cc01[_0x44b857(0xcc)]===void 0x0?{}:{'sheetName':_0x31cc01['sheet']}}}});case _0x44b857(0x89):return b(_0x31cc01,[_0x44b857(0x8b),_0x44b857(0x93),_0x44b857(0x76),'sheet',_0x44b857(0xae),'region',_0x44b857(0xc2),'padding',_0x44b857(0x67)],'Doc'),await _0x153909['capture'](_0x21a07e);case _0x44b857(0xcf):{if(b(_0x31cc01,['sheet',_0x44b857(0xae),_0x44b857(0xbc),_0x44b857(0xc2),_0x44b857(0x96),_0x44b857(0x67)],_0x44b857(0xa6)),_0x31cc01[_0x44b857(0x76)]!==void 0x0&&_0x31cc01[_0x44b857(0x93)]!==!0x0)throw new f(_0x44b857(0xb9));let _0x5ba465=h(_0x31cc01[_0x44b857(0x8b)]),_0x52a376=g(_0x31cc01[_0x44b857(0x76)]);return await _0x153909['capture']({..._0x21a07e,..._0x5ba465===void 0x0&&_0x31cc01['contactSlide']!==!0x0?{}:{'target':{'kind':_0x44b857(0xbf),..._0x5ba465===void 0x0?{}:{'pages':_0x5ba465},..._0x31cc01['contactSlide']===!0x0?{'contactSheet':_0x52a376===void 0x0?{}:{'tile':_0x52a376}}:{}}}});}case _0x44b857(0xc6):{b(_0x31cc01,[_0x44b857(0x8b),_0x44b857(0x93),_0x44b857(0x76),'sheet',_0x44b857(0xae)],'Board');let _0x3e8c64=_(_0x31cc01[_0x44b857(0xc2)]),_0x18bf74=v(_0x31cc01[_0x44b857(0xbc)]),_0x17b6dc=y(_0x44b857(0x81),_0x31cc01[_0x44b857(0x96)]),_0x2ef2d5=y(_0x44b857(0x87),_0x31cc01[_0x44b857(0x67)]);if(_0x3e8c64!==void 0x0&&_0x18bf74!==void 0x0)throw new f(_0x44b857(0x7e));if(_0x3e8c64===void 0x0&&_0x18bf74===void 0x0&&(_0x17b6dc!==void 0x0||_0x2ef2d5!==void 0x0))throw new f('--padding\x20and\x20--scale\x20require\x20--region\x20or\x20--elements');return await _0x153909['capture']({..._0x21a07e,..._0x3e8c64===void 0x0&&_0x18bf74===void 0x0&&_0x17b6dc===void 0x0&&_0x2ef2d5===void 0x0?{}:{'target':{'kind':_0x44b857(0x74),..._0x3e8c64===void 0x0?{}:{'elementIds':_0x3e8c64},..._0x18bf74===void 0x0?{}:{'region':_0x18bf74},..._0x17b6dc===void 0x0?{}:{'padding':_0x17b6dc},..._0x2ef2d5===void 0x0?{}:{'scale':_0x2ef2d5}}}});}case _0x44b857(0xa9):return b(_0x31cc01,[_0x44b857(0x8b),_0x44b857(0x93),_0x44b857(0x76),_0x44b857(0xcc),_0x44b857(0xae),_0x44b857(0xbc),_0x44b857(0xc2),_0x44b857(0x96),_0x44b857(0x67)],_0x44b857(0xe1)),await _0x153909[_0x44b857(0xce)](_0x21a07e);}}function h(_0x985199){const _0x16305b=_0x490b;if(_0x985199===void 0x0||_0x985199[_0x16305b(0x79)]()===_0x16305b(0x9c))return;if(_0x985199[_0x16305b(0x79)]()[_0x16305b(0x8c)]===0x0)throw new f(_0x16305b(0x82));let _0xa0c316=[];for(let _0x413b3c of _0x985199['split'](',')){let _0x40e4e2=_0x413b3c[_0x16305b(0x79)]();if(_0x40e4e2[_0x16305b(0x8c)]===0x0)throw new f('--pages\x20contains\x20an\x20empty\x20selector');let _0x49ac00=/^(\d+)(?:-(\d+))?$/['exec'](_0x40e4e2);if(_0x49ac00===null){_0xa0c316[_0x16305b(0xa3)](_0x40e4e2);continue;}let _0x4d4ca9=Number(_0x49ac00[0x1]),_0x97cea9=Number(_0x49ac00[0x2]??_0x49ac00[0x1]);if(!Number[_0x16305b(0xb4)](_0x4d4ca9)||!Number['isSafeInteger'](_0x97cea9)||_0x4d4ca9<0x1||_0x97cea9<_0x4d4ca9)throw new f(_0x16305b(0xb8)+JSON['stringify'](_0x413b3c['trim']()));if(_0x97cea9-_0x4d4ca9+0x1>d)throw new f(_0x16305b(0x6d)+d+'\x20pages');for(let _0xb8eb1d=_0x4d4ca9;_0xb8eb1d<=_0x97cea9;_0xb8eb1d+=0x1)_0xa0c316[_0x16305b(0xa3)](_0xb8eb1d);if(_0xa0c316[_0x16305b(0x8c)]>d)throw new f(_0x16305b(0xd6)+d+_0x16305b(0xd3));}return[...new Set(_0xa0c316)];}function _0x259d(){const _0x577b7d=['json','):\x20','--pages\x20<pages>','push','out','screenshot\x20browser\x20already\x20installed:\x20','Slide','3KvPftn','Board\x20selector\x20scale\x20between\x200.1\x20and\x204','base','610920SdxofX','resolve','writeOut','exec','range','1635560YWczAH','split','optsWithGlobals','parent','\x20must\x20be\x20a\x20finite\x20number','isSafeInteger','Screenshot\x20writer\x20returned\x20',';\x20expected\x20<columns>x<rows>','Slide\x20overview\x20containing\x20all\x20captured\x20pages','Invalid\x20--pages\x20range\x20','--tile\x20requires\x20--contact-slide','2483400PxPfJT','build:\x20','region','some','--region\x20must\x20contain\x20left,top,width,height\x20as\x20finite\x20numbers','slide-pages','alreadyInstalled','stringify','elements','action','screenshot.setup-failed','--scale\x20<factor>','board','--tile\x20<columns>x<rows>','--region\x20<left,top,width,height>','string','Screenshot\x20writer\x20output\x20','2380322Slfdgd','sheet','\x20is\x20not\x20supported\x20for\x20','capture','slide','--json','Screenshot\x20failed','usable\x20browser\x20found\x20(','\x20pages','code','install','--pages\x20cannot\x20expand\x20to\x20more\x20than\x20','--sheet\x20requires\x20--range','sheet-range','542964oiSikp','Render\x20a\x20Univer\x20Unit\x20as\x20PNG\x20images','unit','Sheet\x20range,\x20for\x20example\x20B2:H40','join','skip\x20discovery\x20and\x20ensure\x20the\x20pinned\x20Chromium\x20build','location','unitType','Base','status','118744cAqXZx','scale','message','writeImages','35BleIbc','resolved','every','A\x20--pages\x20range\x20cannot\x20exceed\x20','screenshot.failed','--elements\x20<ids>','Board\x20element\x20IDs\x20separated\x20by\x20commas','1222056dXutkQ','executablePath','screenshot\x20browser\x20installed:\x20','board-content','Sheet','tile','Browser\x20setup\x20failed','Opaque\x20output\x20destination\x20passed\x20to\x20the\x20writer','trim','run\x20`screenshot\x20setup\x20--force`\x20to\x20ensure\x20the\x20pinned\x20Chromium\x20build','map','Slide\x20pages\x20or\x20page\x20IDs,\x20for\x20example\x201,3-5,cover','configureOutput','--elements\x20and\x20--region\x20cannot\x20be\x20used\x20together','cache:\x20','found','--padding','--pages\x20cannot\x20be\x20empty','\x20does\x20not\x20match\x20the\x20captured\x20image\x20name','8qcEvUg','--region\x20width\x20and\x20height\x20must\x20be\x20positive','\x20images','--scale','Contact\x20slide\x20grid,\x20for\x20example\x204x2','doc','force','pages','length','screenshot','Sheet\x20name\x20used\x20with\x20--range','description','60vbSUOQ','isFinite','images','contactSlide','option','Invalid\x20--tile\x20','padding','Board\x20content\x20padding','source','probe','write\x20a\x20structured\x20output\x20summary\x20as\x20JSON','--unit\x20<unit-id>','all','name','error','cacheDir'];_0x259d=function(){return _0x577b7d;};return _0x259d();}function g(_0x31a5da){const _0x464f87=_0x490b;if(_0x31a5da===void 0x0)return;let _0x21d9f0=/^(\d+)x(\d+)$/iu[_0x464f87(0xad)](_0x31a5da['trim']()),_0x1b58a7=Number(_0x21d9f0?.[0x1]),_0x5b865b=Number(_0x21d9f0?.[0x2]);if(_0x21d9f0===null||!Number[_0x464f87(0xb4)](_0x1b58a7)||_0x1b58a7<0x1||!Number[_0x464f87(0xb4)](_0x5b865b)||_0x5b865b<0x1)throw new f(_0x464f87(0x95)+JSON[_0x464f87(0xc1)](_0x31a5da)+_0x464f87(0xb6));return{'columns':_0x1b58a7,'rows':_0x5b865b};}function _(_0x34f2b8){const _0xbe2e88=_0x490b;if(_0x34f2b8===void 0x0)return;let _0x509e6e=[...new Set(_0x34f2b8[_0xbe2e88(0xb0)](',')[_0xbe2e88(0x7b)](_0x54aced=>_0x54aced[_0xbe2e88(0x79)]()))];if(_0x509e6e[_0xbe2e88(0xbd)](_0x416d8e=>_0x416d8e[_0xbe2e88(0x8c)]===0x0))throw new f('--elements\x20must\x20contain\x20non-empty\x20IDs');return _0x509e6e;}function v(_0x53e70f){const _0x3f8205=_0x490b;if(_0x53e70f===void 0x0)return;let _0x880ceb=_0x53e70f[_0x3f8205(0xb0)](','),_0x268adc=_0x880ceb[_0x3f8205(0x7b)](Number);if(_0x880ceb[_0x3f8205(0x8c)]!==0x4||_0x880ceb['some'](_0x4578e6=>_0x4578e6['trim']()[_0x3f8205(0x8c)]===0x0)||_0x268adc[_0x3f8205(0x8c)]!==0x4||!_0x268adc[_0x3f8205(0x6c)](Number[_0x3f8205(0x91)]))throw new f(_0x3f8205(0xbe));let [_0x7c967b,_0x130d74,_0x138913,_0x34a79b]=_0x268adc;if(_0x138913<=0x0||_0x34a79b<=0x0)throw new f(_0x3f8205(0x85));return{'left':_0x7c967b,'top':_0x130d74,'width':_0x138913,'height':_0x34a79b};}function y(_0x4e74b4,_0x1e7801){const _0x41591a=_0x490b;if(_0x1e7801===void 0x0)return;if(_0x1e7801[_0x41591a(0x79)]()['length']===0x0)throw new f(_0x4e74b4+_0x41591a(0xb3));let _0x2d43c6=Number(_0x1e7801);if(!Number['isFinite'](_0x2d43c6))throw new f(_0x4e74b4+_0x41591a(0xb3));return _0x2d43c6;}function b(_0x1e2165,_0x12bda9,_0x3a91a8){const _0x4bdba6=_0x490b;for(let _0x281998 of _0x12bda9)if(_0x1e2165[_0x281998]!==void 0x0)throw new f('--'+_0x281998['replace'](/[A-Z]/gu,_0x37cf65=>'-'+_0x37cf65['toLowerCase']())+_0x4bdba6(0xcd)+_0x3a91a8);}function x(_0x8aa436,_0x4c4e01){const _0x1b0d41=_0x490b;if(_0x4c4e01[_0x1b0d41(0x8c)]!==_0x8aa436['images'][_0x1b0d41(0x8c)])throw Error(_0x1b0d41(0xb5)+_0x4c4e01[_0x1b0d41(0x8c)]+'\x20outputs\x20for\x20'+_0x8aa436['images']['length']+_0x1b0d41(0x86));for(let _0x21b9c9=0x0;_0x21b9c9<_0x4c4e01['length'];_0x21b9c9+=0x1)if(_0x4c4e01[_0x21b9c9]?.[_0x1b0d41(0x9d)]!==_0x8aa436[_0x1b0d41(0x92)][_0x21b9c9]?.[_0x1b0d41(0x9d)])throw Error(_0x1b0d41(0xca)+(_0x21b9c9+0x1)+_0x1b0d41(0x83));}function S(_0x1ad8a0,_0x58dc86){const _0x5961e6=_0x490b;return{'ok':!0x0,'unitId':_0x1ad8a0['unitId'],'unitKind':_0x1ad8a0['unitType'],'outputs':_0x1ad8a0['images'][_0x5961e6(0x7b)](({bytes:_0xb3bfb0,..._0x38a5e4},_0x45bba6)=>({..._0x38a5e4,'location':_0x58dc86[_0x45bba6][_0x5961e6(0xdf)]}))};}function C(_0x519eff,_0x57377b){const _0x56d39e=_0x490b;_0x57377b instanceof f&&_0x519eff[_0x56d39e(0x9e)](_0x57377b[_0x56d39e(0x68)],{'code':'screenshot.invalid-input','exitCode':0x1}),(_0x57377b instanceof _0x49b088||w(_0x57377b))&&_0x519eff[_0x56d39e(0x9e)](_0x57377b[_0x56d39e(0xd4)]+':\x20'+_0x57377b[_0x56d39e(0x68)],{'code':_0x56d39e(0x6e),'exitCode':0x1}),_0x57377b instanceof Error&&_0x519eff['error'](_0x57377b[_0x56d39e(0x68)],{'code':_0x56d39e(0x6e),'exitCode':0x1}),_0x519eff[_0x56d39e(0x9e)](_0x56d39e(0xd1),{'code':_0x56d39e(0x6e),'exitCode':0x1});}function w(_0x3fc569){const _0x46d38b=_0x490b;return _0x3fc569 instanceof Error&&typeof _0x3fc569[_0x46d38b(0xd4)]==_0x46d38b(0xc9);}export{f as UnitScreenshotCommandInputError,p as createUnitScreenshotCommand,o as createUniverRenderBrowserSetupCommand};
|
|
1
|
+
(function(_0x2f4c21,_0x2edef4){const _0x423439=_0x3cab,_0x2e0136=_0x2f4c21();while(!![]){try{const _0xce2425=parseInt(_0x423439(0xb7))/0x1*(parseInt(_0x423439(0xbc))/0x2)+parseInt(_0x423439(0x91))/0x3*(parseInt(_0x423439(0xff))/0x4)+parseInt(_0x423439(0xa1))/0x5*(parseInt(_0x423439(0xa7))/0x6)+-parseInt(_0x423439(0xdc))/0x7*(parseInt(_0x423439(0xbe))/0x8)+-parseInt(_0x423439(0x96))/0x9*(parseInt(_0x423439(0xf9))/0xa)+-parseInt(_0x423439(0xe0))/0xb+-parseInt(_0x423439(0x10c))/0xc;if(_0xce2425===_0x2edef4)break;else _0x2e0136['push'](_0x2e0136['shift']());}catch(_0x529164){_0x2e0136['push'](_0x2e0136['shift']());}}}(_0x59b0,0x8792b));import{UnitScreenshotError as _0x2c3bc8}from'@univer-cli/unit-screenshot';import{Command as _0x257098}from'commander';function _0x59b0(){const _0x591051=['260xnXzYs','stringify','):\x20','resolve','trim','write\x20a\x20structured\x20output\x20summary\x20as\x20JSON','515560scIhdT','--region\x20width\x20and\x20height\x20must\x20be\x20positive','json','code','error','configureOutput','--sheet\x20<name>','region','map','Screenshot\x20failed','--out\x20<destination>','--region\x20<left,top,width,height>','Sheet\x20name\x20used\x20with\x20--range','6375240TyrQAb','isSafeInteger','UnitScreenshotCommandInputError','tile','Slide','9wzrAfx','--elements\x20must\x20contain\x20non-empty\x20IDs','loadUnit','board','unitId','248634dxqaZt','--pages\x20contains\x20an\x20empty\x20selector','pages','split','slide-pages','--region\x20must\x20contain\x20left,top,width,height\x20as\x20finite\x20numbers','sheet','doc','--json','location','action','15WNTuwG','--padding\x20<pixels>','Screenshot\x20writer\x20returned\x20','A\x20--pages\x20range\x20cannot\x20exceed\x20','Board','executablePath','2012484BTqaBU','--unit\x20<unit-id>','string','toLowerCase','join','Render\x20a\x20Univer\x20Unit\x20as\x20PNG\x20images','found','--sheet\x20requires\x20--range','option','--range\x20<a1-range>','--force','Doc','Resolve\x20or\x20install\x20the\x20browser\x20used\x20for\x20Univer\x20rendering','source','scale','\x20pages','149194gZqsdv','--tile\x20requires\x20--contact-slide','message','out','--padding','10pgUwgj','description','24224zrmcYR','setup','Board\x20content\x20padding','browserSetup','optsWithGlobals','replace','--padding\x20and\x20--scale\x20require\x20--region\x20or\x20--elements','Base','Slide\x20overview\x20containing\x20all\x20captured\x20pages','board-content','\x20must\x20be\x20a\x20finite\x20number','unit','isFinite','contactSlide','every','\x20images','Invalid\x20--tile\x20','exec','elements','status','Screenshot\x20writer\x20output\x20','cacheDir','\x20is\x20not\x20supported\x20for\x20','probe','screenshot\x20browser\x20installed:\x20','--scale\x20<factor>','--elements\x20and\x20--region\x20cannot\x20be\x20used\x20together','--pages\x20cannot\x20be\x20empty','screenshot','write\x20the\x20setup\x20result\x20as\x20JSON','721qiBSCm','\x20does\x20not\x20match\x20the\x20captured\x20image\x20name','buildId','name','243595OMogfP','build:\x20','unitType','\x20outputs\x20for\x20','writeImages','push','padding','screenshot\x20browser\x20already\x20installed:\x20',';\x20expected\x20<columns>x<rows>','Board\x20element\x20IDs\x20separated\x20by\x20commas','sheet-range','screenshot.setup-failed','range','capture','writeOut','Sheet','parent','length','addCommand','resolved','screenshot.failed','run\x20`screenshot\x20setup\x20--force`\x20to\x20ensure\x20the\x20pinned\x20Chromium\x20build','cache:\x20','Contact\x20slide\x20grid,\x20for\x20example\x204x2','images'];_0x59b0=function(){return _0x591051;};return _0x59b0();}function _0x3cab(_0x46e69c,_0x4e1534){_0x46e69c=_0x46e69c-0x90;const _0x59b0d8=_0x59b0();let _0x3cab3e=_0x59b0d8[_0x46e69c];return _0x3cab3e;}import{installUniverRenderBrowser as _0x5b8013,probeUniverRenderBrowser as _0xee5cf6,resolveUniverRenderBrowser as _0x3f8cc6}from'@univer-cli/univer-render-runtime';var a={'install':async()=>await _0x5b8013(),'probe':async _0x44c453=>await _0xee5cf6(_0x44c453),'resolve':async()=>await _0x3f8cc6()};function o(_0x8424fa=a){const _0x4a22be=_0x3cab;let _0x3ff3c1=new _0x257098(_0x4a22be(0xbf))[_0x4a22be(0xbd)](_0x4a22be(0xb3))[_0x4a22be(0xaf)](_0x4a22be(0xb1),'skip\x20discovery\x20and\x20ensure\x20the\x20pinned\x20Chromium\x20build')[_0x4a22be(0xaf)](_0x4a22be(0x9e),_0x4a22be(0xdb));return _0x3ff3c1[_0x4a22be(0xa0)](async _0x527a07=>{const _0x4be112=_0x4a22be;l(_0x3ff3c1);let _0x1ab04a={..._0x3ff3c1[_0x4be112(0xc2)](),..._0x527a07},_0x485743;try{_0x485743=await s(_0x8424fa,_0x1ab04a['force']===!0x0);}catch(_0x404ef4){u(_0x404ef4)&&_0x3ff3c1[_0x4be112(0x103)](_0x404ef4['code']+':\x20'+_0x404ef4[_0x4be112(0xb9)],{'code':'screenshot.setup-failed','exitCode':0x1}),_0x3ff3c1[_0x4be112(0x103)](_0x404ef4 instanceof Error?_0x404ef4['message']:'Browser\x20setup\x20failed',{'code':_0x4be112(0xeb),'exitCode':0x1});}let _0x1d9da0=_0x1ab04a[_0x4be112(0x101)]===!0x0?JSON[_0x4be112(0xfa)]({'ok':!0x0,..._0x485743},null,0x2)+'\x0a':c(_0x485743);_0x3ff3c1[_0x4be112(0x104)]()[_0x4be112(0xee)]?.(_0x1d9da0);}),_0x3ff3c1;}async function s(_0xe03800,_0x2467a4){const _0x1311b4=_0x3cab;if(!_0x2467a4){let _0x4f9f51=await _0xe03800[_0x1311b4(0xfc)]();if(_0x4f9f51[_0x1311b4(0xd1)]===_0x1311b4(0xad))return await _0xe03800[_0x1311b4(0xd5)]({'executablePath':_0x4f9f51[_0x1311b4(0xa6)]}),{'status':'resolved','executablePath':_0x4f9f51[_0x1311b4(0xa6)],'source':_0x4f9f51[_0x1311b4(0xb4)]};}let _0x1fb9bc=await _0xe03800['install']();return await _0xe03800[_0x1311b4(0xd5)]({'executablePath':_0x1fb9bc[_0x1311b4(0xa6)]}),{'status':'installed',..._0x1fb9bc};}function c(_0x57d404){const _0x17f1c0=_0x3cab;return _0x57d404[_0x17f1c0(0xd1)]===_0x17f1c0(0xf3)?['usable\x20browser\x20found\x20('+_0x57d404[_0x17f1c0(0xb4)]+_0x17f1c0(0xfb)+_0x57d404['executablePath'],_0x17f1c0(0xf5),''][_0x17f1c0(0xab)]('\x0a'):[_0x57d404['alreadyInstalled']?_0x17f1c0(0xe7)+_0x57d404[_0x17f1c0(0xa6)]:_0x17f1c0(0xd6)+_0x57d404[_0x17f1c0(0xa6)],_0x17f1c0(0xe1)+_0x57d404[_0x17f1c0(0xde)],_0x17f1c0(0xf6)+_0x57d404[_0x17f1c0(0xd3)],''][_0x17f1c0(0xab)]('\x0a');}function l(_0x103716){const _0x260a91=_0x3cab;_0x103716[_0x260a91(0xf0)]!==null&&_0x103716[_0x260a91(0x104)](_0x103716[_0x260a91(0xf0)][_0x260a91(0x104)]());}function u(_0x1a0e21){const _0x4f3143=_0x3cab;return _0x1a0e21 instanceof Error&&typeof _0x1a0e21[_0x4f3143(0x102)]==_0x4f3143(0xa9);}var d=0x2710,f=class extends Error{constructor(_0x138b06){const _0x330279=_0x3cab;super(_0x138b06),this[_0x330279(0xdf)]=_0x330279(0x10e);}};function p(_0x262dcf){const _0x30b193=_0x3cab;let _0x22a990=new _0x257098(_0x30b193(0xda))[_0x30b193(0xbd)](_0x30b193(0xac))[_0x30b193(0xaf)](_0x30b193(0xa8),'Unit\x20to\x20capture')[_0x30b193(0xaf)]('--pages\x20<pages>','Slide\x20pages\x20or\x20page\x20IDs,\x20for\x20example\x201,3-5,cover')['option']('--contact-slide',_0x30b193(0xc6))['option']('--tile\x20<columns>x<rows>',_0x30b193(0xf7))[_0x30b193(0xaf)](_0x30b193(0x105),_0x30b193(0x10b))['option'](_0x30b193(0xb0),'Sheet\x20range,\x20for\x20example\x20B2:H40')['option'](_0x30b193(0x10a),'Board\x20region')[_0x30b193(0xaf)]('--elements\x20<ids>',_0x30b193(0xe9))['option'](_0x30b193(0xa2),_0x30b193(0xc0))[_0x30b193(0xaf)](_0x30b193(0xd7),'Board\x20selector\x20scale\x20between\x200.1\x20and\x204')[_0x30b193(0xaf)](_0x30b193(0x109),'Opaque\x20output\x20destination\x20passed\x20to\x20the\x20writer')[_0x30b193(0xaf)](_0x30b193(0x9e),_0x30b193(0xfe));return _0x22a990[_0x30b193(0xf2)](o(_0x262dcf[_0x30b193(0xc1)])),_0x22a990[_0x30b193(0xa0)](async _0x2c5975=>{const _0x156b45=_0x30b193;let _0x36ffdd;try{let _0x36cdef=await _0x262dcf[_0x156b45(0x93)](_0x2c5975[_0x156b45(0xc9)]===void 0x0?{}:{'unitId':_0x2c5975[_0x156b45(0xc9)]});_0x36ffdd=await m(_0x262dcf['screenshot'],_0x36cdef,_0x2c5975);}catch(_0x87eb7){C(_0x22a990,_0x87eb7);}let _0x47ef34;try{_0x47ef34=await _0x262dcf[_0x156b45(0xe4)]({'result':_0x36ffdd,..._0x2c5975[_0x156b45(0xba)]===void 0x0?{}:{'destination':_0x2c5975[_0x156b45(0xba)]}}),x(_0x36ffdd,_0x47ef34);}catch(_0x5e00e0){C(_0x22a990,_0x5e00e0);}let _0xa86558=_0x2c5975[_0x156b45(0x101)]===!0x0?JSON[_0x156b45(0xfa)](S(_0x36ffdd,_0x47ef34),null,0x2)+'\x0a':_0x47ef34[_0x156b45(0x107)](({location:_0x4b0fcc})=>_0x4b0fcc)['join']('\x0a')+'\x0a';_0x22a990[_0x156b45(0x104)]()['writeOut']?.(_0xa86558);}),_0x22a990;}async function m(_0x320245,_0x5dfbcf,_0x1e54ec){const _0x4da3b4=_0x3cab;switch(_0x5dfbcf[_0x4da3b4(0xe2)]){case _0x4da3b4(0x9c):if(b(_0x1e54ec,[_0x4da3b4(0x98),_0x4da3b4(0xcb),_0x4da3b4(0x10f),'region',_0x4da3b4(0xd0),_0x4da3b4(0xe6),_0x4da3b4(0xb5)],_0x4da3b4(0xef)),_0x1e54ec[_0x4da3b4(0x9c)]!==void 0x0&&_0x1e54ec['range']===void 0x0)throw new f(_0x4da3b4(0xae));return await _0x320245[_0x4da3b4(0xed)]({..._0x5dfbcf,..._0x1e54ec[_0x4da3b4(0xec)]===void 0x0?{}:{'target':{'kind':_0x4da3b4(0xea),'range':_0x1e54ec[_0x4da3b4(0xec)],..._0x1e54ec[_0x4da3b4(0x9c)]===void 0x0?{}:{'sheetName':_0x1e54ec[_0x4da3b4(0x9c)]}}}});case _0x4da3b4(0x9d):return b(_0x1e54ec,[_0x4da3b4(0x98),_0x4da3b4(0xcb),_0x4da3b4(0x10f),_0x4da3b4(0x9c),_0x4da3b4(0xec),_0x4da3b4(0x106),'elements',_0x4da3b4(0xe6),'scale'],_0x4da3b4(0xb2)),await _0x320245[_0x4da3b4(0xed)](_0x5dfbcf);case'slide':{if(b(_0x1e54ec,[_0x4da3b4(0x9c),_0x4da3b4(0xec),_0x4da3b4(0x106),'elements',_0x4da3b4(0xe6),'scale'],_0x4da3b4(0x90)),_0x1e54ec[_0x4da3b4(0x10f)]!==void 0x0&&_0x1e54ec[_0x4da3b4(0xcb)]!==!0x0)throw new f(_0x4da3b4(0xb8));let _0x5d2424=h(_0x1e54ec[_0x4da3b4(0x98)]),_0x34b14d=g(_0x1e54ec[_0x4da3b4(0x10f)]);return await _0x320245['capture']({..._0x5dfbcf,..._0x5d2424===void 0x0&&_0x1e54ec['contactSlide']!==!0x0?{}:{'target':{'kind':_0x4da3b4(0x9a),..._0x5d2424===void 0x0?{}:{'pages':_0x5d2424},..._0x1e54ec[_0x4da3b4(0xcb)]===!0x0?{'contactSheet':_0x34b14d===void 0x0?{}:{'tile':_0x34b14d}}:{}}}});}case _0x4da3b4(0x94):{b(_0x1e54ec,[_0x4da3b4(0x98),_0x4da3b4(0xcb),_0x4da3b4(0x10f),'sheet',_0x4da3b4(0xec)],_0x4da3b4(0xa5));let _0x3a369f=_(_0x1e54ec[_0x4da3b4(0xd0)]),_0x1ccd40=v(_0x1e54ec[_0x4da3b4(0x106)]),_0x2fadfa=y(_0x4da3b4(0xbb),_0x1e54ec[_0x4da3b4(0xe6)]),_0x5cd66e=y('--scale',_0x1e54ec[_0x4da3b4(0xb5)]);if(_0x3a369f!==void 0x0&&_0x1ccd40!==void 0x0)throw new f(_0x4da3b4(0xd8));if(_0x3a369f===void 0x0&&_0x1ccd40===void 0x0&&(_0x2fadfa!==void 0x0||_0x5cd66e!==void 0x0))throw new f(_0x4da3b4(0xc4));return await _0x320245[_0x4da3b4(0xed)]({..._0x5dfbcf,..._0x3a369f===void 0x0&&_0x1ccd40===void 0x0&&_0x2fadfa===void 0x0&&_0x5cd66e===void 0x0?{}:{'target':{'kind':_0x4da3b4(0xc7),..._0x3a369f===void 0x0?{}:{'elementIds':_0x3a369f},..._0x1ccd40===void 0x0?{}:{'region':_0x1ccd40},..._0x2fadfa===void 0x0?{}:{'padding':_0x2fadfa},..._0x5cd66e===void 0x0?{}:{'scale':_0x5cd66e}}}});}case'base':return b(_0x1e54ec,[_0x4da3b4(0x98),'contactSlide',_0x4da3b4(0x10f),_0x4da3b4(0x9c),_0x4da3b4(0xec),_0x4da3b4(0x106),_0x4da3b4(0xd0),_0x4da3b4(0xe6),_0x4da3b4(0xb5)],_0x4da3b4(0xc5)),await _0x320245['capture'](_0x5dfbcf);}}function h(_0x322300){const _0x21f66d=_0x3cab;if(_0x322300===void 0x0||_0x322300[_0x21f66d(0xfd)]()==='all')return;if(_0x322300['trim']()[_0x21f66d(0xf1)]===0x0)throw new f(_0x21f66d(0xd9));let _0x2f1179=[];for(let _0x1d3410 of _0x322300[_0x21f66d(0x99)](',')){let _0x42c900=_0x1d3410['trim']();if(_0x42c900[_0x21f66d(0xf1)]===0x0)throw new f(_0x21f66d(0x97));let _0x9d2fde=/^(\d+)(?:-(\d+))?$/['exec'](_0x42c900);if(_0x9d2fde===null){_0x2f1179[_0x21f66d(0xe5)](_0x42c900);continue;}let _0x52d72b=Number(_0x9d2fde[0x1]),_0x166b4d=Number(_0x9d2fde[0x2]??_0x9d2fde[0x1]);if(!Number[_0x21f66d(0x10d)](_0x52d72b)||!Number['isSafeInteger'](_0x166b4d)||_0x52d72b<0x1||_0x166b4d<_0x52d72b)throw new f('Invalid\x20--pages\x20range\x20'+JSON['stringify'](_0x1d3410[_0x21f66d(0xfd)]()));if(_0x166b4d-_0x52d72b+0x1>d)throw new f(_0x21f66d(0xa4)+d+_0x21f66d(0xb6));for(let _0x448cdc=_0x52d72b;_0x448cdc<=_0x166b4d;_0x448cdc+=0x1)_0x2f1179[_0x21f66d(0xe5)](_0x448cdc);if(_0x2f1179[_0x21f66d(0xf1)]>d)throw new f('--pages\x20cannot\x20expand\x20to\x20more\x20than\x20'+d+_0x21f66d(0xb6));}return[...new Set(_0x2f1179)];}function g(_0x32cb2e){const _0x56958c=_0x3cab;if(_0x32cb2e===void 0x0)return;let _0x13ec36=/^(\d+)x(\d+)$/iu[_0x56958c(0xcf)](_0x32cb2e[_0x56958c(0xfd)]()),_0x26fb64=Number(_0x13ec36?.[0x1]),_0x62f312=Number(_0x13ec36?.[0x2]);if(_0x13ec36===null||!Number[_0x56958c(0x10d)](_0x26fb64)||_0x26fb64<0x1||!Number['isSafeInteger'](_0x62f312)||_0x62f312<0x1)throw new f(_0x56958c(0xce)+JSON[_0x56958c(0xfa)](_0x32cb2e)+_0x56958c(0xe8));return{'columns':_0x26fb64,'rows':_0x62f312};}function _(_0x218739){const _0x4320e8=_0x3cab;if(_0x218739===void 0x0)return;let _0xf0e5=[...new Set(_0x218739[_0x4320e8(0x99)](',')[_0x4320e8(0x107)](_0x4610a4=>_0x4610a4[_0x4320e8(0xfd)]()))];if(_0xf0e5['some'](_0x1b0052=>_0x1b0052[_0x4320e8(0xf1)]===0x0))throw new f(_0x4320e8(0x92));return _0xf0e5;}function v(_0x3a2154){const _0x120db5=_0x3cab;if(_0x3a2154===void 0x0)return;let _0x44d231=_0x3a2154['split'](','),_0x3c378e=_0x44d231[_0x120db5(0x107)](Number);if(_0x44d231[_0x120db5(0xf1)]!==0x4||_0x44d231['some'](_0x50171d=>_0x50171d[_0x120db5(0xfd)]()[_0x120db5(0xf1)]===0x0)||_0x3c378e[_0x120db5(0xf1)]!==0x4||!_0x3c378e[_0x120db5(0xcc)](Number[_0x120db5(0xca)]))throw new f(_0x120db5(0x9b));let [_0x104b5a,_0x1503e1,_0x8b7956,_0x3d2167]=_0x3c378e;if(_0x8b7956<=0x0||_0x3d2167<=0x0)throw new f(_0x120db5(0x100));return{'left':_0x104b5a,'top':_0x1503e1,'width':_0x8b7956,'height':_0x3d2167};}function y(_0x32845b,_0x5e0ff0){const _0x119975=_0x3cab;if(_0x5e0ff0===void 0x0)return;if(_0x5e0ff0[_0x119975(0xfd)]()['length']===0x0)throw new f(_0x32845b+_0x119975(0xc8));let _0x2c7496=Number(_0x5e0ff0);if(!Number['isFinite'](_0x2c7496))throw new f(_0x32845b+_0x119975(0xc8));return _0x2c7496;}function b(_0x394bdb,_0x32ad59,_0x23d07b){const _0x53f08c=_0x3cab;for(let _0x1c9757 of _0x32ad59)if(_0x394bdb[_0x1c9757]!==void 0x0)throw new f('--'+_0x1c9757[_0x53f08c(0xc3)](/[A-Z]/gu,_0x1b1b49=>'-'+_0x1b1b49[_0x53f08c(0xaa)]())+_0x53f08c(0xd4)+_0x23d07b);}function x(_0x36a0be,_0x56616b){const _0x58fefc=_0x3cab;if(_0x56616b['length']!==_0x36a0be[_0x58fefc(0xf8)]['length'])throw Error(_0x58fefc(0xa3)+_0x56616b[_0x58fefc(0xf1)]+_0x58fefc(0xe3)+_0x36a0be[_0x58fefc(0xf8)][_0x58fefc(0xf1)]+_0x58fefc(0xcd));for(let _0x34f84b=0x0;_0x34f84b<_0x56616b['length'];_0x34f84b+=0x1)if(_0x56616b[_0x34f84b]?.[_0x58fefc(0xdf)]!==_0x36a0be[_0x58fefc(0xf8)][_0x34f84b]?.['name'])throw Error(_0x58fefc(0xd2)+(_0x34f84b+0x1)+_0x58fefc(0xdd));}function S(_0x302207,_0x33eef5){const _0x5ea854=_0x3cab;return{'ok':!0x0,'unitId':_0x302207[_0x5ea854(0x95)],'unitKind':_0x302207[_0x5ea854(0xe2)],'outputs':_0x302207[_0x5ea854(0xf8)][_0x5ea854(0x107)](({bytes:_0x3fc470,..._0x426b28},_0x5a3038)=>({..._0x426b28,'location':_0x33eef5[_0x5a3038][_0x5ea854(0x9f)]}))};}function C(_0x5bc8b5,_0x5523b2){const _0x23c503=_0x3cab;_0x5523b2 instanceof f&&_0x5bc8b5[_0x23c503(0x103)](_0x5523b2[_0x23c503(0xb9)],{'code':'screenshot.invalid-input','exitCode':0x1}),(_0x5523b2 instanceof _0x2c3bc8||w(_0x5523b2))&&_0x5bc8b5[_0x23c503(0x103)](_0x5523b2[_0x23c503(0x102)]+':\x20'+_0x5523b2[_0x23c503(0xb9)],{'code':'screenshot.failed','exitCode':0x1}),_0x5523b2 instanceof Error&&_0x5bc8b5[_0x23c503(0x103)](_0x5523b2[_0x23c503(0xb9)],{'code':'screenshot.failed','exitCode':0x1}),_0x5bc8b5['error'](_0x23c503(0x108),{'code':_0x23c503(0xf4),'exitCode':0x1});}function w(_0x23f1ac){const _0x47a08b=_0x3cab;return _0x23f1ac instanceof Error&&typeof _0x23f1ac[_0x47a08b(0x102)]==_0x47a08b(0xa9);}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.
|
|
4
|
+
"version": "1.4.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.
|
|
22
|
-
"@univer-cli/univer-render-runtime": "1.
|
|
21
|
+
"@univer-cli/unit-screenshot": "1.4.0",
|
|
22
|
+
"@univer-cli/univer-render-runtime": "1.4.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"commander": "^15.0.0"
|