@univer-cli/unit-screenshot-command 1.2.0 → 1.3.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(_0x1a4400,_0x247026){const _0x59ef1c=_0x25f7,_0xadc0bd=_0x1a4400();while(!![]){try{const _0x19f7b0=parseInt(_0x59ef1c(0x175))/0x1+-parseInt(_0x59ef1c(0x1ad))/0x2*(parseInt(_0x59ef1c(0x166))/0x3)+parseInt(_0x59ef1c(0x16e))/0x4*(-parseInt(_0x59ef1c(0x162))/0x5)+parseInt(_0x59ef1c(0x172))/0x6*(parseInt(_0x59ef1c(0x196))/0x7)+-parseInt(_0x59ef1c(0x13f))/0x8+parseInt(_0x59ef1c(0x1b8))/0x9*(parseInt(_0x59ef1c(0x157))/0xa)+parseInt(_0x59ef1c(0x145))/0xb;if(_0x19f7b0===_0x247026)break;else _0xadc0bd['push'](_0xadc0bd['shift']());}catch(_0x57e26f){_0xadc0bd['push'](_0xadc0bd['shift']());}}}(_0x2f5f,0x1c68e));import{UnitScreenshotError as _0x40c636}from'@univer-cli/unit-screenshot';import{Command as _0x26aaad}from'commander';import{installUniverRenderBrowser as _0x1a2243,probeUniverRenderBrowser as _0x3bc79e,resolveUniverRenderBrowser as _0x452f57}from'@univer-cli/univer-render-runtime';var a={'install':async()=>await _0x1a2243(),'probe':async _0x2175e0=>await _0x3bc79e(_0x2175e0),'resolve':async()=>await _0x452f57()};function _0x25f7(_0x1f87cf,_0x4bd667){_0x1f87cf=_0x1f87cf-0x138;const _0x2f5f2c=_0x2f5f();let _0x25f766=_0x2f5f2c[_0x1f87cf];return _0x25f766;}function _0x2f5f(){const _0x1ad664=['--pages\x20cannot\x20be\x20empty','Sheet\x20name\x20used\x20with\x20--range','--padding','source','run\x20`screenshot\x20setup\x20--force`\x20to\x20ensure\x20the\x20pinned\x20Chromium\x20build','Base','sheet-range','join','out','pages','979736IGpTmM','--scale\x20<factor>','parent','browserSetup','--contact-slide','\x20outputs\x20for\x20','1358071MlVstA','Board\x20selector\x20scale\x20between\x200.1\x20and\x204','contactSlide','Board\x20region','screenshot.invalid-input','writeOut','Invalid\x20--pages\x20range\x20','split','found','unitType','screenshot\x20browser\x20installed:\x20','executablePath','board','region','all','string','optsWithGlobals','--tile\x20requires\x20--contact-slide','7570FsQrgU','addCommand','\x20does\x20not\x20match\x20the\x20captured\x20image\x20name','isFinite','Unit\x20to\x20capture','images','Screenshot\x20writer\x20output\x20','toLowerCase','screenshot\x20browser\x20already\x20installed:\x20','isSafeInteger','--elements\x20must\x20contain\x20non-empty\x20IDs','20TzPxJA','range','--out\x20<destination>','name','2319LWwTOa','push','description','Screenshot\x20writer\x20returned\x20','install','scale','status','slide-pages','52276YsOJVw','capture','configureOutput','Resolve\x20or\x20install\x20the\x20browser\x20used\x20for\x20Univer\x20rendering','21198bjsGMf','):\x20','some','60396xYEjnC','\x20pages','Sheet\x20range,\x20for\x20example\x20B2:H40','exec','code','error','Slide','Board','Screenshot\x20failed','UnitScreenshotCommandInputError','resolved','Browser\x20setup\x20failed','action','resolve','Invalid\x20--tile\x20','unit','probe','unitId','screenshot','Opaque\x20output\x20destination\x20passed\x20to\x20the\x20writer','trim','length','sheet','Board\x20content\x20padding','Sheet','--sheet\x20requires\x20--range','Contact\x20slide\x20grid,\x20for\x20example\x204x2','replace','--json','option','alreadyInstalled','message','--sheet\x20<name>','7pFLZKV','padding','\x20is\x20not\x20supported\x20for\x20','Board\x20element\x20IDs\x20separated\x20by\x20commas','--range\x20<a1-range>','every','cache:\x20','board-content','Render\x20a\x20Univer\x20Unit\x20as\x20PNG\x20images','--tile\x20<columns>x<rows>','screenshot.setup-failed','--pages\x20contains\x20an\x20empty\x20selector','tile','loadUnit','--scale','--pages\x20cannot\x20expand\x20to\x20more\x20than\x20','\x20must\x20be\x20a\x20finite\x20number','Slide\x20pages\x20or\x20page\x20IDs,\x20for\x20example\x201,3-5,cover','map','write\x20the\x20setup\x20result\x20as\x20JSON','doc','A\x20--pages\x20range\x20cannot\x20exceed\x20','--padding\x20and\x20--scale\x20require\x20--region\x20or\x20--elements','188qGrmqj','installed','--elements\x20and\x20--region\x20cannot\x20be\x20used\x20together','--padding\x20<pixels>','force','screenshot.failed','stringify','--region\x20must\x20contain\x20left,top,width,height\x20as\x20finite\x20numbers','elements','--elements\x20<ids>','location','2097wEVWdT'];_0x2f5f=function(){return _0x1ad664;};return _0x2f5f();}function o(_0x285b25=a){const _0x1a6863=_0x25f7;let _0x2a1ac6=new _0x26aaad('setup')['description'](_0x1a6863(0x171))[_0x1a6863(0x192)]('--force','skip\x20discovery\x20and\x20ensure\x20the\x20pinned\x20Chromium\x20build')[_0x1a6863(0x192)](_0x1a6863(0x191),_0x1a6863(0x1a9));return _0x2a1ac6[_0x1a6863(0x181)](async _0x16936c=>{const _0x544bc9=_0x1a6863;l(_0x2a1ac6);let _0xed6ee5={..._0x2a1ac6[_0x544bc9(0x155)](),..._0x16936c},_0x567da9;try{_0x567da9=await s(_0x285b25,_0xed6ee5[_0x544bc9(0x1b1)]===!0x0);}catch(_0x2081b1){u(_0x2081b1)&&_0x2a1ac6[_0x544bc9(0x17a)](_0x2081b1[_0x544bc9(0x179)]+':\x20'+_0x2081b1[_0x544bc9(0x194)],{'code':_0x544bc9(0x1a0),'exitCode':0x1}),_0x2a1ac6[_0x544bc9(0x17a)](_0x2081b1 instanceof Error?_0x2081b1['message']:_0x544bc9(0x180),{'code':_0x544bc9(0x1a0),'exitCode':0x1});}let _0x419b64=_0xed6ee5['json']===!0x0?JSON[_0x544bc9(0x1b3)]({'ok':!0x0,..._0x567da9},null,0x2)+'\x0a':c(_0x567da9);_0x2a1ac6[_0x544bc9(0x170)]()[_0x544bc9(0x14a)]?.(_0x419b64);}),_0x2a1ac6;}async function s(_0x24a2ec,_0x2bffad){const _0x317c8c=_0x25f7;if(!_0x2bffad){let _0x3ab8cb=await _0x24a2ec[_0x317c8c(0x182)]();if(_0x3ab8cb[_0x317c8c(0x16c)]===_0x317c8c(0x14d))return await _0x24a2ec['probe']({'executablePath':_0x3ab8cb[_0x317c8c(0x150)]}),{'status':_0x317c8c(0x17f),'executablePath':_0x3ab8cb['executablePath'],'source':_0x3ab8cb['source']};}let _0x2beb91=await _0x24a2ec[_0x317c8c(0x16a)]();return await _0x24a2ec[_0x317c8c(0x185)]({'executablePath':_0x2beb91[_0x317c8c(0x150)]}),{'status':_0x317c8c(0x1ae),..._0x2beb91};}function c(_0x27c714){const _0x8b606f=_0x25f7;return _0x27c714[_0x8b606f(0x16c)]==='resolved'?['usable\x20browser\x20found\x20('+_0x27c714[_0x8b606f(0x138)]+_0x8b606f(0x173)+_0x27c714[_0x8b606f(0x150)],_0x8b606f(0x139),''][_0x8b606f(0x13c)]('\x0a'):[_0x27c714[_0x8b606f(0x193)]?_0x8b606f(0x15f)+_0x27c714[_0x8b606f(0x150)]:_0x8b606f(0x14f)+_0x27c714['executablePath'],'build:\x20'+_0x27c714['buildId'],_0x8b606f(0x19c)+_0x27c714['cacheDir'],''][_0x8b606f(0x13c)]('\x0a');}function l(_0x2d7053){const _0x116bc1=_0x25f7;_0x2d7053[_0x116bc1(0x141)]!==null&&_0x2d7053['configureOutput'](_0x2d7053[_0x116bc1(0x141)][_0x116bc1(0x170)]());}function u(_0x21918b){const _0x250b73=_0x25f7;return _0x21918b instanceof Error&&typeof _0x21918b[_0x250b73(0x179)]==_0x250b73(0x154);}var d=0x2710,f=class extends Error{constructor(_0x251337){const _0x198557=_0x25f7;super(_0x251337),this[_0x198557(0x165)]=_0x198557(0x17e);}};function p(_0x22ecbd){const _0x5cc347=_0x25f7;let _0x26c06e=new _0x26aaad(_0x5cc347(0x187))[_0x5cc347(0x168)](_0x5cc347(0x19e))[_0x5cc347(0x192)]('--unit\x20<unit-id>',_0x5cc347(0x15b))[_0x5cc347(0x192)]('--pages\x20<pages>',_0x5cc347(0x1a7))[_0x5cc347(0x192)](_0x5cc347(0x143),'Slide\x20overview\x20containing\x20all\x20captured\x20pages')['option'](_0x5cc347(0x19f),_0x5cc347(0x18f))[_0x5cc347(0x192)](_0x5cc347(0x195),_0x5cc347(0x1ba))[_0x5cc347(0x192)](_0x5cc347(0x19a),_0x5cc347(0x177))[_0x5cc347(0x192)]('--region\x20<left,top,width,height>',_0x5cc347(0x148))['option'](_0x5cc347(0x1b6),_0x5cc347(0x199))[_0x5cc347(0x192)](_0x5cc347(0x1b0),_0x5cc347(0x18c))['option'](_0x5cc347(0x140),_0x5cc347(0x146))[_0x5cc347(0x192)](_0x5cc347(0x164),_0x5cc347(0x188))[_0x5cc347(0x192)]('--json','write\x20a\x20structured\x20output\x20summary\x20as\x20JSON');return _0x26c06e[_0x5cc347(0x158)](o(_0x22ecbd[_0x5cc347(0x142)])),_0x26c06e[_0x5cc347(0x181)](async _0x535d59=>{const _0x491051=_0x5cc347;let _0x964247;try{let _0x5bfb58=await _0x22ecbd[_0x491051(0x1a3)](_0x535d59[_0x491051(0x184)]===void 0x0?{}:{'unitId':_0x535d59['unit']});_0x964247=await m(_0x22ecbd[_0x491051(0x187)],_0x5bfb58,_0x535d59);}catch(_0x37cb92){C(_0x26c06e,_0x37cb92);}let _0x31c271;try{_0x31c271=await _0x22ecbd['writeImages']({'result':_0x964247,..._0x535d59[_0x491051(0x13d)]===void 0x0?{}:{'destination':_0x535d59['out']}}),x(_0x964247,_0x31c271);}catch(_0x11cbb1){C(_0x26c06e,_0x11cbb1);}let _0x1f0b91=_0x535d59['json']===!0x0?JSON[_0x491051(0x1b3)](S(_0x964247,_0x31c271),null,0x2)+'\x0a':_0x31c271[_0x491051(0x1a8)](({location:_0x537973})=>_0x537973)[_0x491051(0x13c)]('\x0a')+'\x0a';_0x26c06e[_0x491051(0x170)]()[_0x491051(0x14a)]?.(_0x1f0b91);}),_0x26c06e;}async function m(_0x51d164,_0x17a0b5,_0x7b2fee){const _0x5efbde=_0x25f7;switch(_0x17a0b5[_0x5efbde(0x14e)]){case _0x5efbde(0x18b):if(b(_0x7b2fee,[_0x5efbde(0x13e),_0x5efbde(0x147),'tile','region',_0x5efbde(0x1b5),_0x5efbde(0x197),_0x5efbde(0x16b)],_0x5efbde(0x18d)),_0x7b2fee[_0x5efbde(0x18b)]!==void 0x0&&_0x7b2fee[_0x5efbde(0x163)]===void 0x0)throw new f(_0x5efbde(0x18e));return await _0x51d164[_0x5efbde(0x16f)]({..._0x17a0b5,..._0x7b2fee[_0x5efbde(0x163)]===void 0x0?{}:{'target':{'kind':_0x5efbde(0x13b),'range':_0x7b2fee[_0x5efbde(0x163)],..._0x7b2fee[_0x5efbde(0x18b)]===void 0x0?{}:{'sheetName':_0x7b2fee[_0x5efbde(0x18b)]}}}});case _0x5efbde(0x1aa):return b(_0x7b2fee,[_0x5efbde(0x13e),'contactSlide',_0x5efbde(0x1a2),_0x5efbde(0x18b),'range',_0x5efbde(0x152),_0x5efbde(0x1b5),_0x5efbde(0x197),_0x5efbde(0x16b)],'Doc'),await _0x51d164[_0x5efbde(0x16f)](_0x17a0b5);case'slide':{if(b(_0x7b2fee,[_0x5efbde(0x18b),_0x5efbde(0x163),_0x5efbde(0x152),_0x5efbde(0x1b5),'padding',_0x5efbde(0x16b)],_0x5efbde(0x17b)),_0x7b2fee[_0x5efbde(0x1a2)]!==void 0x0&&_0x7b2fee[_0x5efbde(0x147)]!==!0x0)throw new f(_0x5efbde(0x156));let _0x49d0a3=h(_0x7b2fee[_0x5efbde(0x13e)]),_0x58ec4c=g(_0x7b2fee['tile']);return await _0x51d164[_0x5efbde(0x16f)]({..._0x17a0b5,..._0x49d0a3===void 0x0&&_0x7b2fee[_0x5efbde(0x147)]!==!0x0?{}:{'target':{'kind':_0x5efbde(0x16d),..._0x49d0a3===void 0x0?{}:{'pages':_0x49d0a3},..._0x7b2fee[_0x5efbde(0x147)]===!0x0?{'contactSheet':_0x58ec4c===void 0x0?{}:{'tile':_0x58ec4c}}:{}}}});}case _0x5efbde(0x151):{b(_0x7b2fee,[_0x5efbde(0x13e),_0x5efbde(0x147),_0x5efbde(0x1a2),'sheet',_0x5efbde(0x163)],_0x5efbde(0x17c));let _0x4033b1=_(_0x7b2fee['elements']),_0x5a8fb2=v(_0x7b2fee['region']),_0x49bc5f=y(_0x5efbde(0x1bb),_0x7b2fee[_0x5efbde(0x197)]),_0x1e6875=y(_0x5efbde(0x1a4),_0x7b2fee[_0x5efbde(0x16b)]);if(_0x4033b1!==void 0x0&&_0x5a8fb2!==void 0x0)throw new f(_0x5efbde(0x1af));if(_0x4033b1===void 0x0&&_0x5a8fb2===void 0x0&&(_0x49bc5f!==void 0x0||_0x1e6875!==void 0x0))throw new f(_0x5efbde(0x1ac));return await _0x51d164[_0x5efbde(0x16f)]({..._0x17a0b5,..._0x4033b1===void 0x0&&_0x5a8fb2===void 0x0&&_0x49bc5f===void 0x0&&_0x1e6875===void 0x0?{}:{'target':{'kind':_0x5efbde(0x19d),..._0x4033b1===void 0x0?{}:{'elementIds':_0x4033b1},..._0x5a8fb2===void 0x0?{}:{'region':_0x5a8fb2},..._0x49bc5f===void 0x0?{}:{'padding':_0x49bc5f},..._0x1e6875===void 0x0?{}:{'scale':_0x1e6875}}}});}case'base':return b(_0x7b2fee,[_0x5efbde(0x13e),_0x5efbde(0x147),_0x5efbde(0x1a2),_0x5efbde(0x18b),_0x5efbde(0x163),'region',_0x5efbde(0x1b5),_0x5efbde(0x197),'scale'],_0x5efbde(0x13a)),await _0x51d164[_0x5efbde(0x16f)](_0x17a0b5);}}function h(_0x55af5a){const _0x97b84f=_0x25f7;if(_0x55af5a===void 0x0||_0x55af5a['trim']()===_0x97b84f(0x153))return;if(_0x55af5a[_0x97b84f(0x189)]()[_0x97b84f(0x18a)]===0x0)throw new f(_0x97b84f(0x1b9));let _0x43f09b=[];for(let _0x232df1 of _0x55af5a[_0x97b84f(0x14c)](',')){let _0x126e7b=_0x232df1[_0x97b84f(0x189)]();if(_0x126e7b['length']===0x0)throw new f(_0x97b84f(0x1a1));let _0x447225=/^(\d+)(?:-(\d+))?$/[_0x97b84f(0x178)](_0x126e7b);if(_0x447225===null){_0x43f09b['push'](_0x126e7b);continue;}let _0x1f3c3f=Number(_0x447225[0x1]),_0x394fd1=Number(_0x447225[0x2]??_0x447225[0x1]);if(!Number[_0x97b84f(0x160)](_0x1f3c3f)||!Number[_0x97b84f(0x160)](_0x394fd1)||_0x1f3c3f<0x1||_0x394fd1<_0x1f3c3f)throw new f(_0x97b84f(0x14b)+JSON[_0x97b84f(0x1b3)](_0x232df1[_0x97b84f(0x189)]()));if(_0x394fd1-_0x1f3c3f+0x1>d)throw new f(_0x97b84f(0x1ab)+d+'\x20pages');for(let _0x5b72c2=_0x1f3c3f;_0x5b72c2<=_0x394fd1;_0x5b72c2+=0x1)_0x43f09b[_0x97b84f(0x167)](_0x5b72c2);if(_0x43f09b['length']>d)throw new f(_0x97b84f(0x1a5)+d+_0x97b84f(0x176));}return[...new Set(_0x43f09b)];}function g(_0xb28c37){const _0x28ce9e=_0x25f7;if(_0xb28c37===void 0x0)return;let _0x51e2a1=/^(\d+)x(\d+)$/iu[_0x28ce9e(0x178)](_0xb28c37[_0x28ce9e(0x189)]()),_0x278c85=Number(_0x51e2a1?.[0x1]),_0x13d0a5=Number(_0x51e2a1?.[0x2]);if(_0x51e2a1===null||!Number[_0x28ce9e(0x160)](_0x278c85)||_0x278c85<0x1||!Number[_0x28ce9e(0x160)](_0x13d0a5)||_0x13d0a5<0x1)throw new f(_0x28ce9e(0x183)+JSON['stringify'](_0xb28c37)+';\x20expected\x20<columns>x<rows>');return{'columns':_0x278c85,'rows':_0x13d0a5};}function _(_0x263664){const _0x32c702=_0x25f7;if(_0x263664===void 0x0)return;let _0x89c64d=[...new Set(_0x263664[_0x32c702(0x14c)](',')[_0x32c702(0x1a8)](_0x5492e9=>_0x5492e9[_0x32c702(0x189)]()))];if(_0x89c64d[_0x32c702(0x174)](_0x566bc6=>_0x566bc6[_0x32c702(0x18a)]===0x0))throw new f(_0x32c702(0x161));return _0x89c64d;}function v(_0x10734b){const _0x1d1451=_0x25f7;if(_0x10734b===void 0x0)return;let _0x5f3de7=_0x10734b['split'](','),_0x4e372c=_0x5f3de7[_0x1d1451(0x1a8)](Number);if(_0x5f3de7['length']!==0x4||_0x5f3de7['some'](_0x268f46=>_0x268f46[_0x1d1451(0x189)]()[_0x1d1451(0x18a)]===0x0)||_0x4e372c[_0x1d1451(0x18a)]!==0x4||!_0x4e372c[_0x1d1451(0x19b)](Number[_0x1d1451(0x15a)]))throw new f(_0x1d1451(0x1b4));let [_0x25cd1d,_0x14c73d,_0x228845,_0x6c07b4]=_0x4e372c;if(_0x228845<=0x0||_0x6c07b4<=0x0)throw new f('--region\x20width\x20and\x20height\x20must\x20be\x20positive');return{'left':_0x25cd1d,'top':_0x14c73d,'width':_0x228845,'height':_0x6c07b4};}function y(_0x41cdf1,_0x5630df){const _0x3a5261=_0x25f7;if(_0x5630df===void 0x0)return;if(_0x5630df[_0x3a5261(0x189)]()['length']===0x0)throw new f(_0x41cdf1+_0x3a5261(0x1a6));let _0x36114a=Number(_0x5630df);if(!Number['isFinite'](_0x36114a))throw new f(_0x41cdf1+'\x20must\x20be\x20a\x20finite\x20number');return _0x36114a;}function b(_0x19e2e1,_0x2fcb3d,_0x3ec8f2){const _0x895fd0=_0x25f7;for(let _0x3f8139 of _0x2fcb3d)if(_0x19e2e1[_0x3f8139]!==void 0x0)throw new f('--'+_0x3f8139[_0x895fd0(0x190)](/[A-Z]/gu,_0x203c9a=>'-'+_0x203c9a[_0x895fd0(0x15e)]())+_0x895fd0(0x198)+_0x3ec8f2);}function x(_0x2682f8,_0x4cd9cd){const _0x2bdf97=_0x25f7;if(_0x4cd9cd['length']!==_0x2682f8['images']['length'])throw Error(_0x2bdf97(0x169)+_0x4cd9cd[_0x2bdf97(0x18a)]+_0x2bdf97(0x144)+_0x2682f8['images'][_0x2bdf97(0x18a)]+'\x20images');for(let _0x2837db=0x0;_0x2837db<_0x4cd9cd[_0x2bdf97(0x18a)];_0x2837db+=0x1)if(_0x4cd9cd[_0x2837db]?.[_0x2bdf97(0x165)]!==_0x2682f8[_0x2bdf97(0x15c)][_0x2837db]?.[_0x2bdf97(0x165)])throw Error(_0x2bdf97(0x15d)+(_0x2837db+0x1)+_0x2bdf97(0x159));}function S(_0x1a935d,_0x1a1f1a){const _0x351b1c=_0x25f7;return{'ok':!0x0,'unitId':_0x1a935d[_0x351b1c(0x186)],'unitKind':_0x1a935d[_0x351b1c(0x14e)],'outputs':_0x1a935d[_0x351b1c(0x15c)]['map'](({bytes:_0x2a7262,..._0x1193d9},_0x51d982)=>({..._0x1193d9,'location':_0x1a1f1a[_0x51d982][_0x351b1c(0x1b7)]}))};}function C(_0x256fbb,_0x4645bd){const _0x46cffa=_0x25f7;_0x4645bd instanceof f&&_0x256fbb[_0x46cffa(0x17a)](_0x4645bd[_0x46cffa(0x194)],{'code':_0x46cffa(0x149),'exitCode':0x1}),(_0x4645bd instanceof _0x40c636||w(_0x4645bd))&&_0x256fbb[_0x46cffa(0x17a)](_0x4645bd[_0x46cffa(0x179)]+':\x20'+_0x4645bd[_0x46cffa(0x194)],{'code':'screenshot.failed','exitCode':0x1}),_0x4645bd instanceof Error&&_0x256fbb['error'](_0x4645bd[_0x46cffa(0x194)],{'code':_0x46cffa(0x1b2),'exitCode':0x1}),_0x256fbb[_0x46cffa(0x17a)](_0x46cffa(0x17d),{'code':_0x46cffa(0x1b2),'exitCode':0x1});}function w(_0x4ab883){const _0xefd873=_0x25f7;return _0x4ab883 instanceof Error&&typeof _0x4ab883['code']==_0xefd873(0x154);}export{f as UnitScreenshotCommandInputError,p as createUnitScreenshotCommand,o as createUniverRenderBrowserSetupCommand};
|
|
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};
|
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.3.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.3.0",
|
|
22
|
+
"@univer-cli/univer-render-runtime": "1.3.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"commander": "^15.0.0"
|