diff --git a/cli/cmd/cmd.go b/cli/cmd/cmd.go index f5eaa9a..638e114 100644 --- a/cli/cmd/cmd.go +++ b/cli/cmd/cmd.go @@ -9,56 +9,55 @@ // Use of this source code is governed by the UniDoc End User License Agreement // terms that can be accessed at https://unidoc.io/eula/ -package cmd ;import (_e "context";_bc "fmt";_efg "github.com/mitchellh/go-homedir";_g "github.com/spf13/cobra";_fd "github.com/spf13/viper";_fe "github.com/unidoc/unihtml/client";_ab "github.com/unidoc/unihtml/content";_d "github.com/unidoc/unihtml/sizes"; -_a "github.com/unidoc/unipdf/v3/common";_b "os";_ff "path/filepath";_ef "time";);var _egf =&_g .Command {Use :"\u0075n\u0069\u0068\u0074\u006d\u006c",Short :"\u0041\u0020\u0062\u0072\u0069\u0065\u0066\u0020\u0064\u0065\u0073\u0063\u0072i\u0070\u0074\u0069\u006f\u006e\u0020o\u0066\u0020\u0079\u006f\u0075\u0072\u0020\u0061\u0070\u0070\u006c\u0069\u0063a\u0074\u0069\u006f\u006e",Long :"\u0041\u0020\u006c\u006f\u006e\u0067\u0065\u0072\u0020\u0064\u0065\u0073c\u0072\u0069\u0070\u0074i\u006f\u006e\u0020\u0074\u0068\u0061\u0074\u0020s\u0070\u0061n\u0073\u0020\u006d\u0075\u006ct\u0069\u0070\u006c\u0065\u0020\u006c\u0069\u006e\u0065\u0073\u0020\u0061nd\u0020\u006c\u0069\u006b\u0065\u006cy\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u000a\u0065\u0078\u0061\u006d\u0070\u006c\u0065\u0073\u0020\u0061n\u0064\u0020\u0075s\u0061\u0067\u0065\u0020\u006ff\u0020\u0075\u0073\u0069\u006eg \u0079\u006f\u0075\u0072\u0020\u0061\u0070\u0070\u006c\u0069\u0063\u0061\u0074\u0069\u006fn\u002e\u0020\u0046\u006f\u0072\u0020e\u0078\u0061\u006dp\u006c\u0065\u003a\u000a\u000a\u0043\u006f\u0062\u0072\u0061\u0020\u0069s\u0020\u0061\u0020\u0043L\u0049\u0020\u006c\u0069\u0062\u0072\u0061\u0072\u0079\u0020f\u006f\u0072\u0020\u0047\u006f\u0020t\u0068\u0061t\u0020\u0065\u006dp\u006f\u0077\u0065\u0072\u0073\u0020\u0061p\u0070\u006c\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u0073\u002e\u000a\u0054\u0068\u0069\u0073\u0020\u0061\u0070p\u006c\u0069\u0063\u0061\u0074\u0069\u006f\u006e \u0069\u0073 \u0061\u0020\u0074\u006f\u006f\u006c\u0020\u0074o\u0020g\u0065\u006e\u0065\u0072a\u0074\u0065 \u0074\u0068e\u0020\u006e\u0065\u0065\u0064\u0065\u0064\u0020\u0066\u0069\u006ce\u0073\u000a\u0074\u006f\u0020\u0071\u0075\u0069\u0063\u006b\u006cy\u0020\u0063\u0072\u0065\u0061\u0074\u0065\u0020\u0061\u0020\u0043\u006f\u0062\u0072\u0061\u0020\u0061\u0070pl\u0069ca\u0074\u0069on\u002e"}; -var (_eb =generateConfig {};_ba =parametersConfig {PaperWidth :_d .LengthFlag {Length :_d .Inch (8.5).Millimeters ()},PaperHeight :_d .LengthFlag {Length :_d .Inch (11).Millimeters ()},Orientation :_d .Portrait ,MarginTop :_d .LengthFlag {Length :_d .Millimeter (10)},MarginBottom :_d .LengthFlag {Length :_d .Millimeter (10)},MarginLeft :_d .LengthFlag {Length :_d .Millimeter (10)},MarginRight :_d .LengthFlag {Length :_d .Millimeter (10)}}; -);func _gg (cmd *_g .Command ,_eg []string ){_gd :=_ef .Now ();if _abc :=_fd .BindPFlags (cmd .Flags ());_abc !=nil {_bc .Printf ("\u0045\u0072\u0072\u003a\u0020\u0025\u0076\u000a",_abc );_b .Exit (1);};if _ebb :=_fd .Unmarshal (&_eb );_ebb !=nil {_bc .Printf ("\u0045\u0072\u0072\u003a\u0020\u0025\u0076\u000a",_ebb ); -_b .Exit (1);};_gfg ();_dg ,_c :=_b .Stat (_eg [0]);if _c !=nil {_bc .Printf ("\u0045\u0072\u0072\u003a\u0020\u0025\u0076\u000a",_c );_b .Exit (1);};if !_dg .IsDir (){if _ff .Ext (_dg .Name ())!="\u002e\u0068\u0074m\u006c"{_bc .Printf ("\u0045\u0072r\u003a\u0020\u0043\u0075\u0072\u0072\u0065\u006e\u0074\u006c\u0079\u0020\u006f\u006e\u006c\u0079\u0020\u0048\u0054M\u004c\u0020\u0066\u0069\u006c\u0065s\u0020\u0069\u006e\u0070\u0075\u0074\u0053\u0074\u0061\u0074\u0020\u0061\u0072\u0065 \u0073\u0075p\u0070\u006f\u0072\u0074e\u0064\u002e\u0020\u0049\u006ep\u0075\u0074\u003a\u0020\u0025\u0073\u000a",_eg [0]); -_b .Exit (1);};};_fg ,_c :=_b .OpenFile (_eg [1],_b .O_CREATE |_b .O_WRONLY |_b .O_TRUNC ,0700);if _c !=nil {_bc .Printf ("\u0045\u0072\u0072\u003a\u0020\u0025\u0076\u000a",_c );_b .Exit (1);};defer _fg .Close ();_fed :=_fe .New (_fe .Options {HTTPS :_eb .Https ,Hostname :_eb .Host ,Port :_eb .Port ,Prefix :_eb .Prefix }); -_ec ,_cd :=_e .WithTimeout (_e .Background (),_ef .Second *10);defer _cd ();_ed :=_ef .Now ();var _fa _ab .Content ;if _dg .IsDir (){_fa ,_c =_ab .NewZipDirectory (_eg [0]);}else {_fa ,_c =_ab .NewHTMLFile (_eg [0]);};if _c !=nil {_bc .Printf ("\u0045r\u0072\u003a\u0020\u0025\u0076",_c ); -_b .Exit (1);};_ea ,_c :=_fe .BuildHTMLQuery ().PaperWidth (_ba .PaperWidth .Length ).PaperHeight (_ba .PaperHeight .Length ).PageSize (_ba .PageSize ).MarginTop (_ba .MarginTop .Length ).MarginBottom (_ba .MarginBottom .Length ).MarginLeft (_ba .MarginLeft .Length ).MarginRight (_ba .MarginRight .Length ).Orientation (_ba .Orientation ).SetContent (_fa ).Query (); -if _c !=nil {_bc .Printf ("\u0045\u0072\u0072\u003a\u0020\u0025\u0076\u000a",_c );_b .Exit (1);};_ece ,_c :=_fed .ConvertHTML (_ec ,_ea );if _c !=nil {_bc .Printf ("\u0045\u0072\u0072\u003a\u0020\u0025\u0076\u000a",_c );_b .Exit (1);};_a .Log .Trace ("\u0045\u0078\u0065cu\u0074\u0069\u006e\u0067\u0020\u0067\u0065\u006e\u0065r\u0061t\u0065 \u0071u\u0065\u0072\u0079\u0020\u0074\u0061\u006b\u0065\u006e\u003a\u0020\u0025\u0073",_ef .Since (_ed )); -_ed =_ef .Now ();_ ,_c =_fg .Write (_ece .Data );if _c !=nil {_bc .Printf ("\u0045\u0072\u0072\u003a\u0020\u0025\u0076\u000a",_c );_b .Exit (1);};_a .Log .Trace ("\u0057\u0072\u0069\u0074in\u0067\u0020\u0066\u0069\u006c\u0065\u0020\u0074\u0061\u006b\u0065\u006e\u003a\u0020%\u0073",_ef .Since (_ed )); -_bc .Printf ("\u0047\u0065n\u0065\u0072\u0061\u0074\u0065\u0064\u0020\u0077\u0069\u0074\u0068\u0020\u0073\u0075\u0063\u0063\u0065\u0073\u0073\u0020\u0069\u006e %\u0073\u000a",_ef .Since (_gd ));};var _ac =&_g .Command {Use :"\u0067\u0065\u006e\u0065\u0072\u0061\u0074\u0065",Short :"\u0047\u0065\u006e\u0065\u0072a\u0074\u0065\u0073\u0020\u0050\u0044F\u0020\u0062\u0061\u0073\u0065\u0064\u0020o\u006e\u0020\u0074h\u0065\u0020\u0070\u0072o\u0076\u0069\u0064\u0065\u0064\u0020H\u0054\u004d\u004c\u0020\u006f\u0072\u0020\u0064\u0069\u0072\u0065\u0063\u0074\u006f\u0072\u0079\u0020w\u0069\u0074\u0068\u0020\u0074\u0068\u0065\u0020\u0048\u0054\u004d\u004c\u0020\u0066\u0069\u006c\u0065\u0073\u002e",Long :"A\u0020\u006c\u006f\u006e\u0067\u0065\u0072\u0020\u0064e\u0073\u0063\u0072\u0069\u0070\u0074\u0069on\u0020\u0074\u0068\u0061\u0074\u0020s\u0070\u0061\u006e\u0073\u0020\u006d\u0075\u006c\u0074\u0069\u0070\u006c\u0065\u0020\u006c\u0069\u006e\u0065\u0073 \u0061\u006e\u0064\u0020\u006c\u0069\u006b\u0065l\u0079\u0020\u0063o\u006e\u0074\u0061\u0069\u006e\u0073\u0020\u0065\u0078\u0061\u006d\u0070\u006c\u0065\u0073\u000a\u0061\u006e\u0064\u0020\u0075\u0073\u0061\u0067\u0065\u0020\u006f\u0066\u0020u\u0073\u0069\u006e\u0067\u0020\u0079o\u0075\u0072\u0020\u0063o\u006d\u006d\u0061\u006e\u0064\u002e\u0020\u0046\u006f\u0072\u0020e\u0078\u0061\u006d\u0070\u006c\u0065\u003a\u000a\u000a\u0043\u006f\u0062r\u0061\u0020\u0069\u0073\u0020\u0061\u0020\u0043\u004c\u0049\u0020\u006c\u0069\u0062\u0072\u0061r\u0079 \u0066\u006f\u0072\u0020\u0047\u006f\u0020\u0074\u0068\u0061\u0074\u0020\u0065\u006d\u0070\u006f\u0077\u0065\u0072\u0073\u0020\u0061\u0070\u0070\u006c\u0069\u0063\u0061t\u0069\u006f\u006e\u0073\u002e\u000a\u0054\u0068\u0069\u0073\u0020\u0061\u0070\u0070\u006c\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u0020\u0069s\u0020\u0061\u0020\u0074\u006f\u006fl\u0020\u0074\u006f\u0020\u0067\u0065\u006e\u0065\u0072\u0061\u0074\u0065\u0020\u0074\u0068e\u0020n\u0065\u0065\u0064\u0065\u0064\u0020\u0066\u0069\u006c\u0065s\u000a\u0074o\u0020\u0071\u0075\u0069\u0063\u006b\u006c\u0079\u0020\u0063\u0072\u0065\u0061\u0074\u0065\u0020\u0061\u0020C\u006fb\u0072\u0061\u0020\u0061\u0070\u0070\u006c\u0069\u0063\u0061\u0074io\u006e\u002e",Run :_gg ,Args :_g .ExactArgs (2),ArgAliases :[]string {"\u0069\u006e\u0070u\u0074","\u006f\u0075\u0074\u0070\u0075\u0074\u002d\u0070\u0064\u0066"},Example :"\u0067\u0065\u006e\u0065\u0072\u0061\u0074\u0065\u0020\u0069\u006ep\u0075\u0074\u002e\u0068\u0074\u006d\u006c\u0020o\u0075t\u0070\u0075\u0074\u002e\u0070\u0064\u0066\u0020\u002d\u002d\u006f\u0072\u0069\u0065\u006e\u0074\u0061\u0074i\u006f\u006e\u0020\u0070\u006f\u0072\u0074\u0072\u0061\u0069\u0074"}; -func init (){_egf .AddCommand (_ac );_ac .Flags ().IntP ("\u0070\u006f\u0072\u0074","\u0070",8080,"\u0050\u006f\u0072\u0074\u0020\u006f\u0066\u0020\u0074\u0068\u0065 \u0075\u006e\u0069\u0068\u0074\u006d\u006c\u0020\u0073\u0065r\u0076\u0065\u0072");_ac .Flags ().String ("\u0068\u006f\u0073\u0074","\u006co\u0063\u0061\u006c\u0068\u006f\u0073t","\u0048\u006f\u0073t\u0020\u006e\u0061\u006de\u0020\u006f\u0066\u0020\u0074\u0068\u0065 \u0075\u006e\u0069\u0068\u0074\u006d\u006c\u0020\u0073\u0065\u0072\u0076\u0065\u0072"); -_ac .Flags ().BoolP ("\u0068\u0074\u0074p\u0073","\u0073",false ,"\u0050\u0072o\u0074\u006f\u0063\u006fl\u0020\u0075s\u0065\u0064\u0020\u0069\u006e\u0020\u0073\u0065r\u0076\u0065\u0072\u0020\u0063\u006f\u006d\u006d\u0075\u006e\u0069\u0063a\u0074\u0069\u006f\u006e"); -_ac .Flags ().StringP ("\u0070\u0072\u0065\u0066\u0069\u0078","\u0078","","\u0050u\u0062\u006ci\u0063\u0020\u0061\u0070i\u0020\u0070\u0072e\u0066\u0069\u0078\u0020\u0075\u0073\u0065\u0064\u0020by\u0020\u0074\u0068e\u0020\u0075n\u0069\u0068\u0074\u006d\u006c\u0020s\u0065\u0072v\u0065\u0072"); -_ac .Flags ().Var (&_ba .PaperWidth ,"p\u0061\u0070\u0065\u0072\u002d\u0077\u0069\u0064\u0074\u0068","\u0073\u0065\u0074s \u0075\u0070\u0020\u0074\u0068\u0065\u0020\u0070\u0061\u0070\u0065\u0072\u002d\u0077\u0069\u0064\u0074\u0068");_ac .Flags ().Var (&_ba .PaperHeight ,"\u0070\u0061\u0070e\u0072\u002d\u0068\u0065\u0069\u0067\u0068\u0074","\u0073e\u0074\u0073\u0020\u0075\u0070\u0020\u0074\u0068\u0065\u0020\u0070a\u0070\u0065\u0072\u002d\u0068\u0065\u0069\u0067\u0068\u0074"); -_ac .Flags ().Var (&_ba .PageSize ,"\u0070\u0061\u0070\u0065\u0072\u002d\u0073\u0069\u007a\u0065","s\u0065\u0074\u0073\u0020up\u0020t\u0068\u0065\u0020\u0070\u0061g\u0065\u0020\u0073\u0069\u007a\u0065");_ac .Flags ().Var (&_ba .Orientation ,"o\u0072\u0069\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e","\u0073\u0065\u0074\u0073 \u0075\u0070\u0020\u0074\u0068\u0065\u0020\u0070\u0061\u0067e\u0020o\u0072\u0069\u0065\u006e\u0074\u0061\u0074i\u006f\u006e"); -_ac .Flags ().Var (&_ba .MarginTop ,"\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0074\u006f\u0070","\u0073\u0065\u0074\u0073 u\u0070\u0020\u0074\u0068\u0065\u0020\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0074o\u0070");_ac .Flags ().Var (&_ba .MarginBottom ,"\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0062\u006f\u0074\u0074\u006f\u006d","\u0073e\u0074\u0073\u0020\u0075p\u0020\u0074\u0068\u0065\u0020m\u0061r\u0067i\u006e\u002d\u0062\u006f\u0074\u0074\u006fm"); -_ac .Flags ().Var (&_ba .MarginRight ,"\u006d\u0061\u0072g\u0069\u006e\u002d\u0072\u0069\u0067\u0068\u0074","\u0073e\u0074\u0073\u0020\u0075\u0070\u0020\u0074\u0068\u0065\u0020\u006da\u0072\u0067\u0069\u006e\u002d\u0072\u0069\u0067\u0068\u0074");_ac .Flags ().Var (&_ba .MarginLeft ,"m\u0061\u0072\u0067\u0069\u006e\u002d\u006c\u0065\u0066\u0074","\u0073\u0065\u0074\u0073 u\u0070\u0020\u0074\u0068\u0065\u0020\u0070\u0061\u0070\u0065\u0072\u002d\u006c\u0065f\u0074"); -};func _gfg (){_ca :=_a .LogLevelInfo ;if _fb {_ca =_a .LogLevelDebug ;};if _abf {_ca =_a .LogLevelTrace ;};_a .Log =_a .NewConsoleLogger (_ca );};var (_fb ,_abf bool ;);type generateConfig struct{Port int `mapstructure:"port"`;Host string `mapstructure:"host"`; -Https bool `mapstructure:"https"`;Prefix string `mapstructure:"prefix"`;};var _gge string ;type parametersConfig struct{ +package cmd ;import (_a "context";_c "fmt";_f "github.com/mitchellh/go-homedir";_ca "github.com/spf13/cobra";_cg "github.com/spf13/viper";_e "github.com/unidoc/unihtml/client";_cd "github.com/unidoc/unihtml/content";_bb "github.com/unidoc/unihtml/sizes"; +_bc "github.com/unidoc/unipdf/v3/common";_db "os";_g "path/filepath";_b "time";);func _ae (){_ba :=_bc .LogLevelInfo ;if _dfc {_ba =_bc .LogLevelDebug ;};if _dgd {_ba =_bc .LogLevelTrace ;};_bc .Log =_bc .NewConsoleLogger (_ba );};var _ebf =&_ca .Command {Use :"\u0075n\u0069\u0068\u0074\u006d\u006c",Short :"\u0041\u0020\u0062\u0072\u0069\u0065\u0066\u0020\u0064\u0065\u0073\u0063\u0072i\u0070\u0074\u0069\u006f\u006e\u0020o\u0066\u0020\u0079\u006f\u0075\u0072\u0020\u0061\u0070\u0070\u006c\u0069\u0063a\u0074\u0069\u006f\u006e",Long :"\u0041\u0020\u006c\u006f\u006e\u0067\u0065\u0072\u0020\u0064\u0065\u0073c\u0072\u0069\u0070\u0074i\u006f\u006e\u0020\u0074\u0068\u0061\u0074\u0020s\u0070\u0061n\u0073\u0020\u006d\u0075\u006ct\u0069\u0070\u006c\u0065\u0020\u006c\u0069\u006e\u0065\u0073\u0020\u0061nd\u0020\u006c\u0069\u006b\u0065\u006cy\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u000a\u0065\u0078\u0061\u006d\u0070\u006c\u0065\u0073\u0020\u0061n\u0064\u0020\u0075s\u0061\u0067\u0065\u0020\u006ff\u0020\u0075\u0073\u0069\u006eg \u0079\u006f\u0075\u0072\u0020\u0061\u0070\u0070\u006c\u0069\u0063\u0061\u0074\u0069\u006fn\u002e\u0020\u0046\u006f\u0072\u0020e\u0078\u0061\u006dp\u006c\u0065\u003a\u000a\u000a\u0043\u006f\u0062\u0072\u0061\u0020\u0069s\u0020\u0061\u0020\u0043L\u0049\u0020\u006c\u0069\u0062\u0072\u0061\u0072\u0079\u0020f\u006f\u0072\u0020\u0047\u006f\u0020t\u0068\u0061t\u0020\u0065\u006dp\u006f\u0077\u0065\u0072\u0073\u0020\u0061p\u0070\u006c\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u0073\u002e\u000a\u0054\u0068\u0069\u0073\u0020\u0061\u0070p\u006c\u0069\u0063\u0061\u0074\u0069\u006f\u006e \u0069\u0073 \u0061\u0020\u0074\u006f\u006f\u006c\u0020\u0074o\u0020g\u0065\u006e\u0065\u0072a\u0074\u0065 \u0074\u0068e\u0020\u006e\u0065\u0065\u0064\u0065\u0064\u0020\u0066\u0069\u006ce\u0073\u000a\u0074\u006f\u0020\u0071\u0075\u0069\u0063\u006b\u006cy\u0020\u0063\u0072\u0065\u0061\u0074\u0065\u0020\u0061\u0020\u0043\u006f\u0062\u0072\u0061\u0020\u0061\u0070pl\u0069ca\u0074\u0069on\u002e"}; +var _da =&_ca .Command {Use :"\u0067\u0065\u006e\u0065\u0072\u0061\u0074\u0065",Short :"\u0047\u0065\u006e\u0065\u0072a\u0074\u0065\u0073\u0020\u0050\u0044F\u0020\u0062\u0061\u0073\u0065\u0064\u0020o\u006e\u0020\u0074h\u0065\u0020\u0070\u0072o\u0076\u0069\u0064\u0065\u0064\u0020H\u0054\u004d\u004c\u0020\u006f\u0072\u0020\u0064\u0069\u0072\u0065\u0063\u0074\u006f\u0072\u0079\u0020w\u0069\u0074\u0068\u0020\u0074\u0068\u0065\u0020\u0048\u0054\u004d\u004c\u0020\u0066\u0069\u006c\u0065\u0073\u002e",Long :"A\u0020\u006c\u006f\u006e\u0067\u0065\u0072\u0020\u0064e\u0073\u0063\u0072\u0069\u0070\u0074\u0069on\u0020\u0074\u0068\u0061\u0074\u0020s\u0070\u0061\u006e\u0073\u0020\u006d\u0075\u006c\u0074\u0069\u0070\u006c\u0065\u0020\u006c\u0069\u006e\u0065\u0073 \u0061\u006e\u0064\u0020\u006c\u0069\u006b\u0065l\u0079\u0020\u0063o\u006e\u0074\u0061\u0069\u006e\u0073\u0020\u0065\u0078\u0061\u006d\u0070\u006c\u0065\u0073\u000a\u0061\u006e\u0064\u0020\u0075\u0073\u0061\u0067\u0065\u0020\u006f\u0066\u0020u\u0073\u0069\u006e\u0067\u0020\u0079o\u0075\u0072\u0020\u0063o\u006d\u006d\u0061\u006e\u0064\u002e\u0020\u0046\u006f\u0072\u0020e\u0078\u0061\u006d\u0070\u006c\u0065\u003a\u000a\u000a\u0043\u006f\u0062r\u0061\u0020\u0069\u0073\u0020\u0061\u0020\u0043\u004c\u0049\u0020\u006c\u0069\u0062\u0072\u0061r\u0079 \u0066\u006f\u0072\u0020\u0047\u006f\u0020\u0074\u0068\u0061\u0074\u0020\u0065\u006d\u0070\u006f\u0077\u0065\u0072\u0073\u0020\u0061\u0070\u0070\u006c\u0069\u0063\u0061t\u0069\u006f\u006e\u0073\u002e\u000a\u0054\u0068\u0069\u0073\u0020\u0061\u0070\u0070\u006c\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u0020\u0069s\u0020\u0061\u0020\u0074\u006f\u006fl\u0020\u0074\u006f\u0020\u0067\u0065\u006e\u0065\u0072\u0061\u0074\u0065\u0020\u0074\u0068e\u0020n\u0065\u0065\u0064\u0065\u0064\u0020\u0066\u0069\u006c\u0065s\u000a\u0074o\u0020\u0071\u0075\u0069\u0063\u006b\u006c\u0079\u0020\u0063\u0072\u0065\u0061\u0074\u0065\u0020\u0061\u0020C\u006fb\u0072\u0061\u0020\u0061\u0070\u0070\u006c\u0069\u0063\u0061\u0074io\u006e\u002e",Run :_gf ,Args :_ca .ExactArgs (2),ArgAliases :[]string {"\u0069\u006e\u0070u\u0074","\u006f\u0075\u0074\u0070\u0075\u0074\u002d\u0070\u0064\u0066"},Example :"\u0067\u0065\u006e\u0065\u0072\u0061\u0074\u0065\u0020\u0069\u006ep\u0075\u0074\u002e\u0068\u0074\u006d\u006c\u0020o\u0075t\u0070\u0075\u0074\u002e\u0070\u0064\u0066\u0020\u002d\u002d\u006f\u0072\u0069\u0065\u006e\u0074\u0061\u0074i\u006f\u006e\u0020\u0070\u006f\u0072\u0074\u0072\u0061\u0069\u0074"}; +func _gf (cmd *_ca .Command ,_ff []string ){_ec :=_b .Now ();if _bbg :=_cg .BindPFlags (cmd .Flags ());_bbg !=nil {_c .Printf ("\u0045\u0072\u0072\u003a\u0020\u0025\u0076\u000a",_bbg );_db .Exit (1);};if _ed :=_cg .Unmarshal (&_df );_ed !=nil {_c .Printf ("\u0045\u0072\u0072\u003a\u0020\u0025\u0076\u000a",_ed ); +_db .Exit (1);};_ae ();_ga ,_dg :=_db .Stat (_ff [0]);if _dg !=nil {_c .Printf ("\u0045\u0072\u0072\u003a\u0020\u0025\u0076\u000a",_dg );_db .Exit (1);};if !_ga .IsDir (){if _g .Ext (_ga .Name ())!="\u002e\u0068\u0074m\u006c"{_c .Printf ("\u0045\u0072r\u003a\u0020\u0043\u0075\u0072\u0072\u0065\u006e\u0074\u006c\u0079\u0020\u006f\u006e\u006c\u0079\u0020\u0048\u0054M\u004c\u0020\u0066\u0069\u006c\u0065s\u0020\u0069\u006e\u0070\u0075\u0074\u0053\u0074\u0061\u0074\u0020\u0061\u0072\u0065 \u0073\u0075p\u0070\u006f\u0072\u0074e\u0064\u002e\u0020\u0049\u006ep\u0075\u0074\u003a\u0020\u0025\u0073\u000a",_ff [0]); +_db .Exit (1);};};_fb ,_dg :=_db .OpenFile (_ff [1],_db .O_CREATE |_db .O_WRONLY |_db .O_TRUNC ,0700);if _dg !=nil {_c .Printf ("\u0045\u0072\u0072\u003a\u0020\u0025\u0076\u000a",_dg );_db .Exit (1);};defer _fb .Close ();_bg :=_e .New (_e .Options {HTTPS :_df .Https ,Hostname :_df .Host ,Port :_df .Port ,Prefix :_df .Prefix }); +_cde ,_eeb :=_a .WithTimeout (_a .Background (),_b .Second *10);defer _eeb ();_dgc :=_b .Now ();var _eb _cd .Content ;if _ga .IsDir (){_eb ,_dg =_cd .NewZipDirectory (_ff [0]);}else {_eb ,_dg =_cd .NewHTMLFile (_ff [0]);};if _dg !=nil {_c .Printf ("\u0045r\u0072\u003a\u0020\u0025\u0076",_dg ); +_db .Exit (1);};_ad ,_dg :=_e .BuildHTMLQuery ().PaperWidth (_ag .PaperWidth .Length ).PaperHeight (_ag .PaperHeight .Length ).PageSize (_ag .PageSize ).MarginTop (_ag .MarginTop .Length ).MarginBottom (_ag .MarginBottom .Length ).MarginLeft (_ag .MarginLeft .Length ).MarginRight (_ag .MarginRight .Length ).Orientation (_ag .Orientation ).SetContent (_eb ).Query (); +if _dg !=nil {_c .Printf ("\u0045\u0072\u0072\u003a\u0020\u0025\u0076\u000a",_dg );_db .Exit (1);};_dc ,_dg :=_bg .ConvertHTML (_cde ,_ad );if _dg !=nil {_c .Printf ("\u0045\u0072\u0072\u003a\u0020\u0025\u0076\u000a",_dg );_db .Exit (1);};_bc .Log .Trace ("\u0045\u0078\u0065cu\u0074\u0069\u006e\u0067\u0020\u0067\u0065\u006e\u0065r\u0061t\u0065 \u0071u\u0065\u0072\u0079\u0020\u0074\u0061\u006b\u0065\u006e\u003a\u0020\u0025\u0073",_b .Since (_dgc )); +_dgc =_b .Now ();_ ,_dg =_fb .Write (_dc .Data );if _dg !=nil {_c .Printf ("\u0045\u0072\u0072\u003a\u0020\u0025\u0076\u000a",_dg );_db .Exit (1);};_bc .Log .Trace ("\u0057\u0072\u0069\u0074in\u0067\u0020\u0066\u0069\u006c\u0065\u0020\u0074\u0061\u006b\u0065\u006e\u003a\u0020%\u0073",_b .Since (_dgc )); +_c .Printf ("\u0047\u0065n\u0065\u0072\u0061\u0074\u0065\u0064\u0020\u0077\u0069\u0074\u0068\u0020\u0073\u0075\u0063\u0063\u0065\u0073\u0073\u0020\u0069\u006e %\u0073\u000a",_b .Since (_ec ));};func init (){_ebf .AddCommand (_da );_da .Flags ().IntP ("\u0070\u006f\u0072\u0074","\u0070",8080,"\u0050\u006f\u0072\u0074\u0020\u006f\u0066\u0020\u0074\u0068\u0065 \u0075\u006e\u0069\u0068\u0074\u006d\u006c\u0020\u0073\u0065r\u0076\u0065\u0072"); +_da .Flags ().String ("\u0068\u006f\u0073\u0074","\u006co\u0063\u0061\u006c\u0068\u006f\u0073t","\u0048\u006f\u0073t\u0020\u006e\u0061\u006de\u0020\u006f\u0066\u0020\u0074\u0068\u0065 \u0075\u006e\u0069\u0068\u0074\u006d\u006c\u0020\u0073\u0065\u0072\u0076\u0065\u0072"); +_da .Flags ().BoolP ("\u0068\u0074\u0074p\u0073","\u0073",false ,"\u0050\u0072o\u0074\u006f\u0063\u006fl\u0020\u0075s\u0065\u0064\u0020\u0069\u006e\u0020\u0073\u0065r\u0076\u0065\u0072\u0020\u0063\u006f\u006d\u006d\u0075\u006e\u0069\u0063a\u0074\u0069\u006f\u006e"); +_da .Flags ().StringP ("\u0070\u0072\u0065\u0066\u0069\u0078","\u0078","","\u0050u\u0062\u006ci\u0063\u0020\u0061\u0070i\u0020\u0070\u0072e\u0066\u0069\u0078\u0020\u0075\u0073\u0065\u0064\u0020by\u0020\u0074\u0068e\u0020\u0075n\u0069\u0068\u0074\u006d\u006c\u0020s\u0065\u0072v\u0065\u0072"); +_da .Flags ().Var (&_ag .PaperWidth ,"p\u0061\u0070\u0065\u0072\u002d\u0077\u0069\u0064\u0074\u0068","\u0073\u0065\u0074s \u0075\u0070\u0020\u0074\u0068\u0065\u0020\u0070\u0061\u0070\u0065\u0072\u002d\u0077\u0069\u0064\u0074\u0068");_da .Flags ().Var (&_ag .PaperHeight ,"\u0070\u0061\u0070e\u0072\u002d\u0068\u0065\u0069\u0067\u0068\u0074","\u0073e\u0074\u0073\u0020\u0075\u0070\u0020\u0074\u0068\u0065\u0020\u0070a\u0070\u0065\u0072\u002d\u0068\u0065\u0069\u0067\u0068\u0074"); +_da .Flags ().Var (&_ag .PageSize ,"\u0070\u0061\u0070\u0065\u0072\u002d\u0073\u0069\u007a\u0065","s\u0065\u0074\u0073\u0020up\u0020t\u0068\u0065\u0020\u0070\u0061g\u0065\u0020\u0073\u0069\u007a\u0065");_da .Flags ().Var (&_ag .Orientation ,"o\u0072\u0069\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e","\u0073\u0065\u0074\u0073 \u0075\u0070\u0020\u0074\u0068\u0065\u0020\u0070\u0061\u0067e\u0020o\u0072\u0069\u0065\u006e\u0074\u0061\u0074i\u006f\u006e"); +_da .Flags ().Var (&_ag .MarginTop ,"\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0074\u006f\u0070","\u0073\u0065\u0074\u0073 u\u0070\u0020\u0074\u0068\u0065\u0020\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0074o\u0070");_da .Flags ().Var (&_ag .MarginBottom ,"\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0062\u006f\u0074\u0074\u006f\u006d","\u0073e\u0074\u0073\u0020\u0075p\u0020\u0074\u0068\u0065\u0020m\u0061r\u0067i\u006e\u002d\u0062\u006f\u0074\u0074\u006fm"); +_da .Flags ().Var (&_ag .MarginRight ,"\u006d\u0061\u0072g\u0069\u006e\u002d\u0072\u0069\u0067\u0068\u0074","\u0073e\u0074\u0073\u0020\u0075\u0070\u0020\u0074\u0068\u0065\u0020\u006da\u0072\u0067\u0069\u006e\u002d\u0072\u0069\u0067\u0068\u0074");_da .Flags ().Var (&_ag .MarginLeft ,"m\u0061\u0072\u0067\u0069\u006e\u002d\u006c\u0065\u0066\u0074","\u0073\u0065\u0074\u0073 u\u0070\u0020\u0074\u0068\u0065\u0020\u0070\u0061\u0070\u0065\u0072\u002d\u006c\u0065f\u0074"); +};func _fbf (){if _bcc !=""{_cg .SetConfigFile (_bcc );}else {_cdac ,_aa :=_f .Dir ();if _aa !=nil {_c .Println (_aa );_db .Exit (1);};_cg .AddConfigPath (_cdac );_cg .SetConfigName ("\u002e\u0075\u006ei\u0068\u0074\u006d\u006c\u002d\u0073\u0072\u0063"); +};_cg .AutomaticEnv ();if _af :=_cg .ReadInConfig ();_af ==nil {_c .Println ("\u0055s\u0069n\u0067\u0020\u0063\u006f\u006ef\u0069\u0067 \u0066\u0069\u006c\u0065\u003a",_cg .ConfigFileUsed ());};};var (_dfc ,_dgd bool ;);type generateConfig struct{Port int `mapstructure:"port"`; +Host string `mapstructure:"host"`;Https bool `mapstructure:"https"`;Prefix string `mapstructure:"prefix"`;}; + +// Execute adds all child commands to the root command and sets flags appropriately. +// This is called by main.main(). It only needs to happen once to the rootCmd. +func Execute (){if _ebg :=_ebf .Execute ();_ebg !=nil {_c .Println (_ebg );_db .Exit (1);};};var (_df =generateConfig {};_ag =parametersConfig {PaperWidth :_bb .LengthFlag {Length :_bb .Inch (8.5).Millimeters ()},PaperHeight :_bb .LengthFlag {Length :_bb .Inch (11).Millimeters ()},Orientation :_bb .Portrait ,MarginTop :_bb .LengthFlag {Length :_bb .Millimeter (10)},MarginBottom :_bb .LengthFlag {Length :_bb .Millimeter (10)},MarginLeft :_bb .LengthFlag {Length :_bb .Millimeter (10)},MarginRight :_bb .LengthFlag {Length :_bb .Millimeter (10)}}; +);func init (){_ca .OnInitialize (_fbf );_ebf .PersistentFlags ().BoolVarP (&_dfc ,"\u0064\u0065\u0062u\u0067","\u0064",false ,"\u0044e\u0066i\u006e\u0065\u0073\u0020\u0064e\u0062\u0075g\u0020\u006d\u006f\u0064\u0065");_ebf .PersistentFlags ().BoolVarP (&_dgd ,"\u0076e\u0072\u0062\u006f\u0073\u0065","\u0076",false ,"\u0056\u0065\u0072\u0062\u006f\u0073e\u0020\u0069\u006e\u0066\u006f\u0072\u006d\u0061\u0074\u0069\u006f\u006e\u0020o\u0066\u0020\u0074\u0068\u0065\u0020\u0063l\u0069\u0065\u006e\u0074"); +_ebf .PersistentFlags ().StringVar (&_bcc ,"\u0063\u006f\u006e\u0066\u0069\u0067","","\u0063\u006f\u006e\u0066\u0069\u0067\u0020\u0066i\u006c\u0065\u0020(d\u0065\u0066\u0061\u0075\u006c\u0074 \u0069\u0073\u0020\u0024\u0048\u004f\u004d\u0045\u002f\u002e\u0075\u006e\u0069\u0068\u0074m\u006c\u002d\u0073\u0072\u0063\u002e\u0079\u0061m\u006c\u0029"); +_ebf .Flags ().BoolP ("\u0074\u006f\u0067\u0067\u006c\u0065","\u0074",false ,"\u0048\u0065\u006cp \u006d\u0065\u0073\u0073\u0061\u0067\u0065\u0020\u0066\u006f\u0072\u0020\u0074\u006f\u0067\u0067\u006c\u0065");};type parametersConfig struct{ // PaperWidth sets the width of the paper. -PaperWidth _d .LengthFlag `mapstructure:"paper-width"`; +PaperWidth _bb .LengthFlag `mapstructure:"paper-width"`; // PaperHeight is the height of the output paper. -PaperHeight _d .LengthFlag `mapstructure:"paper-height"`; +PaperHeight _bb .LengthFlag `mapstructure:"paper-height"`; // PageSize is the page size string. -PageSize _d .PageSize `mapstructure:"page-size"`; +PageSize _bb .PageSize `mapstructure:"page-size"`; // Orientation defines if the output should be in a landscape format. -Orientation _d .Orientation `mapstructure:"orientation"`; +Orientation _bb .Orientation `mapstructure:"orientation"`; // MarginTop sets up the Top Margin for the output. -MarginTop _d .LengthFlag `mapstructure:"margin-top"`; +MarginTop _bb .LengthFlag `mapstructure:"margin-top"`; // MarginBottom sets up the Bottom Margin for the output. -MarginBottom _d .LengthFlag `mapstructure:"margin-bottom"`; +MarginBottom _bb .LengthFlag `mapstructure:"margin-bottom"`; // MarginLeft sets up the Left Margin for the output. -MarginLeft _d .LengthFlag `mapstructure:"margin-left"`; +MarginLeft _bb .LengthFlag `mapstructure:"margin-left"`; // MarginRight sets up the Right Margin for the output. -MarginRight _d .LengthFlag `mapstructure:"margin-right"`;};func init (){_g .OnInitialize (_ga );_egf .PersistentFlags ().BoolVarP (&_fb ,"\u0064\u0065\u0062u\u0067","\u0064",false ,"\u0044e\u0066i\u006e\u0065\u0073\u0020\u0064e\u0062\u0075g\u0020\u006d\u006f\u0064\u0065"); -_egf .PersistentFlags ().BoolVarP (&_abf ,"\u0076e\u0072\u0062\u006f\u0073\u0065","\u0076",false ,"\u0056\u0065\u0072\u0062\u006f\u0073e\u0020\u0069\u006e\u0066\u006f\u0072\u006d\u0061\u0074\u0069\u006f\u006e\u0020o\u0066\u0020\u0074\u0068\u0065\u0020\u0063l\u0069\u0065\u006e\u0074"); -_egf .PersistentFlags ().StringVar (&_gge ,"\u0063\u006f\u006e\u0066\u0069\u0067","","\u0063\u006f\u006e\u0066\u0069\u0067\u0020\u0066i\u006c\u0065\u0020(d\u0065\u0066\u0061\u0075\u006c\u0074 \u0069\u0073\u0020\u0024\u0048\u004f\u004d\u0045\u002f\u002e\u0075\u006e\u0069\u0068\u0074m\u006c\u002d\u0073\u0072\u0063\u002e\u0079\u0061m\u006c\u0029"); -_egf .Flags ().BoolP ("\u0074\u006f\u0067\u0067\u006c\u0065","\u0074",false ,"\u0048\u0065\u006cp \u006d\u0065\u0073\u0073\u0061\u0067\u0065\u0020\u0066\u006f\u0072\u0020\u0074\u006f\u0067\u0067\u006c\u0065");}; - -// Execute adds all child commands to the root command and sets flags appropriately. -// This is called by main.main(). It only needs to happen once to the rootCmd. -func Execute (){if _baa :=_egf .Execute ();_baa !=nil {_bc .Println (_baa );_b .Exit (1);};};func _ga (){if _gge !=""{_fd .SetConfigFile (_gge );}else {_fgf ,_bb :=_efg .Dir ();if _bb !=nil {_bc .Println (_bb );_b .Exit (1);};_fd .AddConfigPath (_fgf ); -_fd .SetConfigName ("\u002e\u0075\u006ei\u0068\u0074\u006d\u006c\u002d\u0073\u0072\u0063");};_fd .AutomaticEnv ();if _gae :=_fd .ReadInConfig ();_gae ==nil {_bc .Println ("\u0055s\u0069n\u0067\u0020\u0063\u006f\u006ef\u0069\u0067 \u0066\u0069\u006c\u0065\u003a",_fd .ConfigFileUsed ()); -};}; \ No newline at end of file +MarginRight _bb .LengthFlag `mapstructure:"margin-right"`;};var _bcc string ; \ No newline at end of file diff --git a/client/client.go b/client/client.go index 65a50d7..03eee18 100644 --- a/client/client.go +++ b/client/client.go @@ -11,200 +11,202 @@ // Package client contains HTML Converter HTTP Client. The Client implements htmlcreator.HTMLConverter interface // for the UniPDF module and can be used as a plugin for the UniPDF creator.Creator. -package client ;import (_cg "bytes";_ge "compress/flate";_af "compress/gzip";_a "context";_g "encoding/json";_f "errors";_eg "fmt";_fcg "github.com/unidoc/unihtml/content";_gedc "github.com/unidoc/unihtml/selector";_ae "github.com/unidoc/unihtml/sizes"; -_gb "github.com/unidoc/unipdf/v3/common";_c "io/ioutil";_e "net";_fc "net/http";_ga "net/url";_ged "strconv";_bg "strings";_d "time";); +package client ;import (_aa "bytes";_de "compress/flate";_a "compress/gzip";_df "context";_c "encoding/json";_g "errors";_ac "fmt";_fa "github.com/unidoc/unihtml/content";_dbe "github.com/unidoc/unihtml/selector";_b "github.com/unidoc/unihtml/sizes";_da "github.com/unidoc/unipdf/v3/common"; +_e "io/ioutil";_af "net";_dee "net/http";_db "net/url";_eb "strconv";_ca "strings";_f "time";);type generatePDFRequestV1 struct{Content []byte `json:"content"`;ContentType string `json:"contentType"`;ContentURL string `json:"contentURL"`;Method string `json:"method"`; +ExpiresAt int64 `json:"expiresAt"`;TimeoutDuration int64 `json:"timeoutDuration,omitempty"`;PageParameters ;RenderParameters ;}; -// WithHTTPS sets the TLS option for the client options. -func WithHTTPS (useHTTPS bool )Option {return func (_dfd *Options ){_dfd .HTTPS =useHTTPS }}; +// WithPrefix sets the client prefix. +func WithPrefix (prefix string )Option {return func (_fae *Options ){_fae .Prefix =prefix }}; -// ParseOptions parses options for the Client. -func ParseOptions (connectPath string )(Options ,error ){if !_bg .HasPrefix (connectPath ,"\u0068\u0074\u0074\u0070"){connectPath ="\u0068t\u0074\u0070\u003a\u002f\u002f"+connectPath ;};_fg ,_gbg :=_ga .Parse (connectPath );if _gbg !=nil {return Options {},_eg .Errorf ("p\u0072\u006f\u0076\u0069\u0064\u0065d\u0020\u0069\u006e\u0076\u0061\u006ci\u0064\u0020\u0075\u006e\u0069\u0068\u0074m\u006c\u002d\u0073\u0065\u0072\u0076\u0065\u0072\u0020\u0075r\u006c"); -};var _ac int ;if _fg .Port ()!=""{_ac ,_gbg =_ged .Atoi (_fg .Port ());if _gbg !=nil {return Options {},_eg .Errorf ("\u0070\u0061\u0072si\u006e\u0067\u0020\u0070\u006f\u0072\u0074\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u003a\u0020\u0025\u0077",_gbg ); -};};return Options {Hostname :_fg .Hostname (),Port :_ac ,HTTPS :_fg .Scheme =="\u0068\u0074\u0074p\u0073",Prefix :_fg .Path },nil ;};func (_aeb *Client )getGenerateRequest (_bc _a .Context ,_gc *Query )(*_fc .Request ,error ){_ag :=generatePDFRequestV1 {Method :_gc .Method ,PageParameters :_gc .PageParameters ,RenderParameters :_gc .RenderParameters ,TimeoutDuration :int64 (_gc .TimeoutDuration )}; -switch _gc .Method {case "\u0077\u0065\u0062":_ag .ContentURL =_gc .URL ;case "\u0064\u0069\u0072","\u0068\u0074\u006d\u006c":_ag .ContentType =_gc .ContentType ;_ag .Content =_gc .Content ;};_fa :=new (_cg .Buffer );if _gda :=_g .NewEncoder (_fa ).Encode (&_ag ); -_gda !=nil {return nil ,_eg .Errorf ("e\u006e\u0063\u006f\u0064\u0069\u006eg\u0020\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0020f\u0061\u0069\u006ce\u0064:\u0020\u0025\u0076",_gda );};_aa :=_aeb .Options .Addr ();_aa =_eg .Sprintf ("%\u0073\u002f\u0062\u0065\u0074\u0061\u002f\u0070\u0064\u0066",_aa ); -_fgd ,_dfe :=_fc .NewRequest ("\u0050\u004f\u0053\u0054",_aa ,_fa );if _dfe !=nil {return nil ,_dfe ;};_fgd .Header .Set ("\u0043\u006f\u006et\u0065\u006e\u0074\u002d\u0054\u0079\u0070\u0065","\u0061\u0070p\u006c\u0069\u0063a\u0074\u0069\u006f\u006e\u002f\u006a\u0073\u006f\u006e"); -_fgd .Header .Set ("\u0041c\u0063e\u0070\u0074\u002d\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067","\u0064\u0065\u0066\u006ca\u0074\u0065\u002c\u0020\u0067\u007a\u0069\u0070\u003b\u0071=\u0031.\u0030\u002c\u0020\u002a\u003b\u0071\u003d0\u002e\u0035"); -_fgd =_fgd .WithContext (_bc );return _fgd ,nil ;}; +// PaperWidth sets up the PaperWidth (in cm) parameter for the query. +func (_gce *QueryBuilder )PaperWidth (paperWidth _b .Length )*QueryBuilder {_gce ._agg .PageParameters .PaperWidth =paperWidth ;return _gce ;}; -// MarginBottom sets up the MarginBottom parameter for the query. -func (_ece *QueryBuilder )MarginBottom (marginBottom _ae .Length )*QueryBuilder {_ece ._gaa .PageParameters .MarginBottom =marginBottom ;return _ece ;};type generatePDFRequestV1 struct{Content []byte `json:"content"`;ContentType string `json:"contentType"`; -ContentURL string `json:"contentURL"`;Method string `json:"method"`;ExpiresAt int64 `json:"expiresAt"`;TimeoutDuration int64 `json:"timeoutDuration,omitempty"`;PageParameters ;RenderParameters ;}; +// ConvertHTML converts provided Query input into PDF file data. +// Implements creator.HTMLConverter interface. +func (_ag *Client )ConvertHTML (ctx _df .Context ,q *Query )(*PDFResponse ,error ){if _gg :=q .Validate ();_gg !=nil {return nil ,_gg ;};_gde ,_eg :=_ag .getGenerateRequest (ctx ,q );if _eg !=nil {return nil ,_eg ;};_da .Log .Trace ("\u0052\u0065\u0071\u0075\u0065\u0073\u0074 \u002d\u0020\u0025s\u0020\u002d\u0020\u0025s\u0025\u0073\u002c\u0020\u0048\u0065\u0061\u0064\u0065\u0072\u0073\u003a\u0020\u0025\u0076\u002c\u0020\u0051\u0075\u0065\u0072\u0079\u003a\u0020\u0025\u0076",_gde .Method ,_gde .URL .Hostname (),_gde .URL .Path ,_gde .Header ,_gde .URL .Query ()); +_cd :=*_ag .Client ;if q .TimeoutDuration !=0{_cd .Timeout =q .TimeoutDuration ;};_cf ,_eg :=_cd .Do (_gde );if _eg !=nil {return nil ,_eg ;};var _gc error ;switch _cf .StatusCode {case _dee .StatusNotFound :_gc =ErrNotFound ;case _dee .StatusBadRequest :_gc =ErrBadRequest ; +case _dee .StatusNotImplemented :_gc =ErrNotImplemented ;case _dee .StatusUnauthorized :_gc =ErrUnauthorized ;case _dee .StatusRequestTimeout :_gc =ErrTimedOut ;case _dee .StatusCreated :default:_gc =ErrInternalError ;};_ee :=_cf .Body ;switch _cf .Header .Get ("\u0043\u006fn\u0074\u0065\u006et\u002d\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067"){case "\u0067\u007a\u0069\u0070":_ee ,_eg =_a .NewReader (_cf .Body ); +if _eg !=nil {return nil ,_eg ;};case "\u0064e\u0066\u006c\u0061\u0074\u0065":_ee =_de .NewReader (_cf .Body );case "":default:return nil ,_ac .Errorf ("\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0043o\u006e\u0074\u0065\u006e\u0074\u002dE\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u003a\u0020\u0025\u0073\u0020\u0068e\u0061\u0064\u0065\u0072",_cf .Header .Get ("\u0043\u006fn\u0074\u0065\u006et\u002d\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067")); +};_bc ,_eg :=_e .ReadAll (_ee );if _eg !=nil &&_gc ==nil {return nil ,_ac .Errorf ("\u0055\u006e\u0069HT\u004d\u004c\u0020\u0073\u0065\u0072\u0076\u0065\u0072\u0020\u0065\u0072\u0072\u006f\u0072\u0020\u0025\u0073",_eg );};_da .Log .Trace ("\u005b\u0025\u0064]\u0020\u0025\u0073\u0020\u0025\u0073\u0025\u0073",_cf .StatusCode ,_gde .Method ,_gde .URL .Host ,_gde .URL .Path ); +if _gc !=nil {return nil ,_ac .Errorf ("\u0025\u0073\u0020%\u0077",string (_bc ),_gc );};_dfd :=_cf .Header .Get ("\u0058\u002d\u004a\u006f\u0062\u002d\u0049\u0044");_da .Log .Trace ("\u0052\u0065\u0073\u0070\u006f\u006e\u0073\u0065\u0020I\u0044\u0020\u0025\u0073",_dfd ); +return &PDFResponse {ID :_dfd ,Data :_bc },nil ;}; -// HealthCheck connects to the server and check the health status of the server. -func (_cf *Client )HealthCheck (ctx _a .Context )error {_df :=_cf .Options .Addr ();_df =_eg .Sprintf ("\u0025s\u002f\u0068\u0065\u0061\u006c\u0074h",_df );_cb ,_ec :=_fc .NewRequest ("\u0047\u0045\u0054",_df ,nil );if _ec !=nil {return _ec ;};_cb =_cb .WithContext (ctx ); -_ed ,_ec :=_cf .Client .Do (_cb );if _ec !=nil {return _ec ;};switch _ed .StatusCode {case _fc .StatusOK :return nil ;case _fc .StatusNotFound :return ErrNotFound ;case _fc .StatusInternalServerError :return ErrInternalError ;case _fc .StatusBadGateway :return ErrBadGateway ; -default:return ErrNotImplemented ;};}; +// Portrait sets up the portrait page orientation. +func (_gcd *QueryBuilder )Portrait ()*QueryBuilder {_gcd ._agg .PageParameters .Orientation =_b .Portrait ;return _gcd ;}; -// Client is a structure that is a HTTP client for the unihtml server. -type Client struct{Options Options ;Client *_fc .Client ;}; +// WithHostname sets the Hostname option for the client options. +func WithHostname (option string )Option {return func (_ec *Options ){_ec .Hostname =option }}; -// Landscape sets up the landscape portrait orientation. -func (_dac *QueryBuilder )Landscape ()*QueryBuilder {_dac ._gaa .PageParameters .Orientation =_ae .Landscape ;return _dac ;}; +// Validate checks if provided Query is valid. +func (_ddd *Query )Validate ()error {switch _ddd .Method {case "\u0077\u0065\u0062":if _ddd .URL ==""{return ErrMissingData ;};case "\u0064\u0069\u0072","\u0068\u0074\u006d\u006c":if len (_ddd .Content )==0{return ErrMissingData ;};if _ddd .ContentType ==""{return ErrContentType ; +};default:return _ac .Errorf ("\u0075\u006e\u0064ef\u0069\u006e\u0065\u0064\u0020\u0063\u006f\u006e\u0074e\u006et\u0020q\u0075e\u0072\u0079\u0020\u006d\u0065\u0074\u0068\u006f\u0072\u003a\u0020\u0025\u0073",_ddd .Method );};if _bg :=_ddd .PageParameters .Validate (); +_bg !=nil {return _bg ;};if _gba :=_ddd .RenderParameters .Validate ();_gba !=nil {return _gba ;};return nil ;}; -// SetContent sets custom data with it's content type. -func (_bcb *QueryBuilder )SetContent (content _fcg .Content )*QueryBuilder {if _bcb ._gee !=nil {return _bcb ;};switch content .Method (){case "\u0064\u0069\u0072","\u0068\u0074\u006d\u006c":if _bcb ._gaa .ContentType !=""{_bcb ._gee =ErrContentTypeDeclared ; -return _bcb ;};if content .ContentType ()==""{_bcb ._gee =_eg .Errorf ("\u0065\u006d\u0070\u0074y\u0020\u0063\u0075\u0073\u0074\u006f\u006d\u0020\u0063\u006fn\u0074e\u006e\u0074\u0020\u0074\u0079\u0070\u0065 \u0025\u0077",ErrContentType );return _bcb ; -};_bcb ._gaa .Content =content .Data ();_bcb ._gaa .ContentType =content .ContentType ();case "\u0077\u0065\u0062":if _bcb ._gaa .ContentType !=""{_bcb ._gee =ErrContentTypeDeclared ;return _bcb ;};_bcb ._gaa .URL =string (content .Data ());_bcb ._gaa .ContentType =content .ContentType (); -default:_bcb ._gee =_eg .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0063\u006f\u006et\u0065\u006e\u0074\u0020\u006d\u0065\u0074\u0068\u006f\u0064:\u0020\u0025\u0073",content .Method ());return _bcb ;};_bcb ._gaa .Method =content .Method (); -return _bcb ;}; +// Option is a function that changes client options. +type Option func (_dd *Options ); -// WaitTime sets the minimum load time parameter for the page rendering. -func (_gfc *QueryBuilder )WaitTime (d _d .Duration )*QueryBuilder {_gfc ._gaa .RenderParameters .WaitTime =d ;return _gfc ;}; +// Validate checks the validity of the RenderParameters. +func (_acg *RenderParameters )Validate ()error {if _acg .WaitTime > _f .Minute *3{return _g .New ("\u0074\u006f\u006f\u0020\u006c\u006f\u006e\u0067 \u006d\u0069\u006eim\u0075\u006d\u0020\u006c\u006f\u0061d\u0020\u0074\u0069\u006d\u0065\u002e\u0020\u004d\u0061\u0078\u0069\u006d\u0075\u006d\u0020i\u0073\u0020\u0033\u0020\u006d\u0069\u006e\u0075t\u0065\u0073"); +};for _ ,_gb :=range _acg .WaitReady {if _fbb :=_gb .Validate ();_fbb !=nil {return _ac .Errorf ("\u006f\u006e\u0065\u0020\u006f\u0066\u0020w\u0061\u0069\u0074 \u0072\u0065\u0061\u0064y\u0020\u0073\u0065\u006c\u0065\u0063\u0074\u006f\u0072\u0020\u0069\u0073\u0020\u006e\u006f\u0074\u0020\u0076\u0061\u006c\u0069\u0064\u003a\u0020\u0025\u0077",_fbb ); +};};return nil ;};func (_cfc *Client )setQueryValues (_ffe *_dee .Request ,_ce *Query ){_caf :=_ffe .URL .Query ();_cc :=_ce .PageParameters ;if _cc .PageSize !=nil {_caf .Set ("\u0070a\u0067\u0065\u002d\u0073\u0069\u007ae",_cc .PageSize .String ());}; +if _cc .PaperHeight !=nil {_caf .Set ("\u0070\u0061\u0070e\u0072\u002d\u0068\u0065\u0069\u0067\u0068\u0074",_cc .PaperHeight .String ());};if _cc .PaperWidth !=nil {_caf .Set ("p\u0061\u0070\u0065\u0072\u002d\u0077\u0069\u0064\u0074\u0068",_cc .PaperWidth .String ()); +};if _cc .MarginTop !=nil {_caf .Set ("\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0074\u006f\u0070",_cc .MarginTop .String ());};if _cc .MarginBottom !=nil {_caf .Set ("\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0062\u006f\u0074\u0074\u006f\u006d",_cc .MarginBottom .String ()); +};if _cc .MarginRight !=nil {_caf .Set ("\u006d\u0061\u0072g\u0069\u006e\u002d\u0072\u0069\u0067\u0068\u0074",_cc .MarginRight .String ());};if _cc .MarginLeft !=nil {_caf .Set ("m\u0061\u0072\u0067\u0069\u006e\u002d\u006c\u0065\u0066\u0074",_cc .MarginLeft .String ()); +};if _cc .Orientation ==_b .Landscape {_caf .Set ("o\u0072\u0069\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e",_cc .Orientation .String ());};if _ce .RenderParameters .WaitTime !=0{_caf .Set ("\u006d\u0069\u006e\u0069\u006d\u0075\u006d\u002d\u006c\u006f\u0061\u0064-\u0074\u0069\u006d\u0065",_eb .FormatInt (int64 (_ce .RenderParameters .WaitTime /_f .Millisecond ),10)); +};_ffe .URL .RawQuery =_caf .Encode ();}; -// PaperHeight sets up the PaperHeight (in cm) parameter for the query. -func (_da *QueryBuilder )PaperHeight (paperHeight _ae .Length )*QueryBuilder {_da ._gaa .PageParameters .PaperHeight =paperHeight ;return _da ;}; +// HealthCheck connects to the server and check the health status of the server. +func (_fg *Client )HealthCheck (ctx _df .Context )error {_ad :=_fg .Options .Addr ();_ad =_ac .Sprintf ("\u0025s\u002f\u0068\u0065\u0061\u006c\u0074h",_ad );_fe ,_fb :=_dee .NewRequest ("\u0047\u0045\u0054",_ad ,nil );if _fb !=nil {return _fb ;};_fe =_fe .WithContext (ctx ); +_feb ,_fb :=_fg .Client .Do (_fe );if _fb !=nil {return _fb ;};switch _feb .StatusCode {case _dee .StatusOK :return nil ;case _dee .StatusNotFound :return ErrNotFound ;case _dee .StatusInternalServerError :return ErrInternalError ;case _dee .StatusBadGateway :return ErrBadGateway ; +default:return ErrNotImplemented ;};}; -// Addr gets the HTTP address URI used by the http.Client. -func (_ee *Options )Addr ()string {_dc :=_bg .Builder {};_dc .WriteString ("\u0068\u0074\u0074\u0070");if _ee .HTTPS {_dc .WriteRune ('s');};_dc .WriteString ("\u003a\u002f\u002f");_dc .WriteString (_ee .Hostname );_dc .WriteRune (':');_dc .WriteString (_ged .Itoa (_ee .Port )); -if _ee .Prefix !=""{_dc .WriteString (_ee .Prefix );};return _dc .String ();}; +// ParseOptions parses options for the Client. +func ParseOptions (connectPath string )(Options ,error ){if !_ca .HasPrefix (connectPath ,"\u0068\u0074\u0074\u0070"){connectPath ="\u0068t\u0074\u0070\u003a\u002f\u002f"+connectPath ;};_gd ,_ebd :=_db .Parse (connectPath );if _ebd !=nil {return Options {},_ac .Errorf ("p\u0072\u006f\u0076\u0069\u0064\u0065d\u0020\u0069\u006e\u0076\u0061\u006ci\u0064\u0020\u0075\u006e\u0069\u0068\u0074m\u006c\u002d\u0073\u0065\u0072\u0076\u0065\u0072\u0020\u0075r\u006c"); +};var _bb int ;if _gd .Port ()!=""{_bb ,_ebd =_eb .Atoi (_gd .Port ());if _ebd !=nil {return Options {},_ac .Errorf ("\u0070\u0061\u0072si\u006e\u0067\u0020\u0070\u006f\u0072\u0074\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u003a\u0020\u0025\u0077",_ebd ); +};};return Options {Hostname :_gd .Hostname (),Port :_bb ,HTTPS :_gd .Scheme =="\u0068\u0074\u0074p\u0073",Prefix :_gd .Path },nil ;}; -// MarginRight sets up the MarginRight parameter for the query. -func (_fd *QueryBuilder )MarginRight (marginRight _ae .Length )*QueryBuilder {_fd ._gaa .PageParameters .MarginRight =marginRight ;return _fd ;};var (ErrNotFound =_f .New ("\u006eo\u0074\u0020\u0066\u006f\u0075\u006ed");ErrBadRequest =_f .New ("b\u0061\u0064\u0020\u0072\u0065\u0071\u0075\u0065\u0073\u0074"); -ErrNotImplemented =_f .New ("\u006eo\u0074 \u0069\u006d\u0070\u006c\u0065\u006d\u0065\u006e\u0074\u0065\u0064");ErrInternalError =_f .New ("i\u006e\u0074\u0065\u0072na\u006c \u0073\u0065\u0072\u0076\u0065r\u0020\u0065\u0072\u0072\u006f\u0072");ErrBadGateway =_f .New ("b\u0061\u0064\u0020\u0067\u0061\u0074\u0065\u0077\u0061\u0079"); -ErrUnauthorized =_f .New ("\u0075\u006e\u0061u\u0074\u0068\u006f\u0072\u0069\u007a\u0065\u0064");ErrTimedOut =_f .New ("\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0020\u0074\u0069\u006d\u0065d\u0020\u006f\u0075\u0074");); +// RenderParameters are the parameters related with the rendering. +type RenderParameters struct{WaitTime _f .Duration `schema:"minimum-load-time" json:"waitTime"`;WaitReady []BySelector `json:"waitReady"`;WaitVisible []BySelector `json:"waitVisible"`;}; -// Validate checks the validity of the RenderParameters. -func (_cbc *RenderParameters )Validate ()error {if _cbc .WaitTime > _d .Minute *3{return _f .New ("\u0074\u006f\u006f\u0020\u006c\u006f\u006e\u0067 \u006d\u0069\u006eim\u0075\u006d\u0020\u006c\u006f\u0061d\u0020\u0074\u0069\u006d\u0065\u002e\u0020\u004d\u0061\u0078\u0069\u006d\u0075\u006d\u0020i\u0073\u0020\u0033\u0020\u006d\u0069\u006e\u0075t\u0065\u0073"); -};for _ ,_bcg :=range _cbc .WaitReady {if _ca :=_bcg .Validate ();_ca !=nil {return _eg .Errorf ("\u006f\u006e\u0065\u0020\u006f\u0066\u0020w\u0061\u0069\u0074 \u0072\u0065\u0061\u0064y\u0020\u0073\u0065\u006c\u0065\u0063\u0074\u006f\u0072\u0020\u0069\u0073\u0020\u006e\u006f\u0074\u0020\u0076\u0061\u006c\u0069\u0064\u003a\u0020\u0025\u0077",_ca ); -};};return nil ;}; +// SetContent sets custom data with it's content type. +func (_febbf *QueryBuilder )SetContent (content _fa .Content )*QueryBuilder {if _febbf ._fgb !=nil {return _febbf ;};switch content .Method (){case "\u0064\u0069\u0072","\u0068\u0074\u006d\u006c":if _febbf ._agg .ContentType !=""{_febbf ._fgb =ErrContentTypeDeclared ; +return _febbf ;};if content .ContentType ()==""{_febbf ._fgb =_ac .Errorf ("\u0065\u006d\u0070\u0074y\u0020\u0063\u0075\u0073\u0074\u006f\u006d\u0020\u0063\u006fn\u0074e\u006e\u0074\u0020\u0074\u0079\u0070\u0065 \u0025\u0077",ErrContentType );return _febbf ; +};_febbf ._agg .Content =content .Data ();_febbf ._agg .ContentType =content .ContentType ();case "\u0077\u0065\u0062":if _febbf ._agg .ContentType !=""{_febbf ._fgb =ErrContentTypeDeclared ;return _febbf ;};_febbf ._agg .URL =string (content .Data ()); +_febbf ._agg .ContentType =content .ContentType ();default:_febbf ._fgb =_ac .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0063\u006f\u006et\u0065\u006e\u0074\u0020\u006d\u0065\u0074\u0068\u006f\u0064:\u0020\u0025\u0073",content .Method ()); +return _febbf ;};_febbf ._agg .Method =content .Method ();return _febbf ;}; // MarginTop sets up the MarginTop parameter for the query. -func (_gdag *QueryBuilder )MarginTop (marginTop _ae .Length )*QueryBuilder {_gdag ._gaa .PageParameters .MarginTop =marginTop ;return _gdag ;}; +func (_ea *QueryBuilder )MarginTop (marginTop _b .Length )*QueryBuilder {_ea ._agg .PageParameters .MarginTop =marginTop ;return _ea ;}; -// Query gets the Query from provided query builder. If some error occurred during build process -// or the input is not valid the function would return an error. -func (_eda *QueryBuilder )Query ()(*Query ,error ){if _gbe :=_eda .Validate ();_gbe !=nil {return nil ,_gbe ;};return &_eda ._gaa ,nil ;}; +// BySelector is a structure that defines a selector with it's query 'by' type. +type BySelector struct{Selector string `json:"selector"`;By _dbe .ByType `json:"by"`;}; -// PaperWidth sets up the PaperWidth (in cm) parameter for the query. -func (_bb *QueryBuilder )PaperWidth (paperWidth _ae .Length )*QueryBuilder {_bb ._gaa .PageParameters .PaperWidth =paperWidth ;return _bb ;}; +// QueryBuilder is the query that converts HTMLConverter defined data +type QueryBuilder struct{_agg Query ;_fgb error ;}; -// Validate checks if the parameters are valid. -func (_be *PageParameters )Validate ()error {if _be .PaperWidth !=nil {if _be .PaperWidth .Millimeters ()< 0{return _f .New ("\u006e\u0065g\u0061\u0074\u0069\u0076\u0065\u0020\u0076\u0061\u006c\u0075\u0065\u0020\u0066\u006f\u0072\u0020\u0050\u0061\u0070\u0065\u0072\u0057id\u0074\u0068"); -};};if _be .PaperHeight !=nil {if _be .PaperHeight .Millimeters ()< 0{return _f .New ("\u006e\u0065\u0067\u0061\u0074\u0069\u0076\u0065\u0020\u0076a\u006c\u0075\u0065\u0020\u0066\u006f\u0072 \u0050\u0061\u0070\u0065\u0072\u0048\u0065\u0069\u0067\u0068\u0074"); -};};if _be .MarginTop !=nil {if _be .MarginTop .Millimeters ()< 0{return _f .New ("\u006e\u0065\u0067\u0061t\u0069\u0076\u0065\u0020\u0076\u0061\u006c\u0075\u0065\u0020f\u006fr\u0020\u004d\u0061\u0072\u0067\u0069\u006eT\u006f\u0070");};};if _be .MarginBottom !=nil {if _be .MarginBottom .Millimeters ()< 0{return _f .New ("\u006e\u0065\u0067a\u0074\u0069\u0076\u0065 \u0076\u0061\u006c\u0075\u0065\u0020\u0066o\u0072\u0020\u004d\u0061\u0072\u0067\u0069\u006e\u0042\u006f\u0074\u0074\u006f\u006d"); -};};if _be .MarginLeft !=nil {if _be .MarginLeft .Millimeters ()< 0{return _f .New ("\u006e\u0065g\u0061\u0074\u0069\u0076\u0065\u0020\u0076\u0061\u006c\u0075\u0065\u0020\u0066\u006f\u0072\u0020\u004d\u0061\u0072\u0067\u0069\u006eLe\u0066\u0074");};};if _be .MarginRight !=nil {if _be .MarginRight .Millimeters ()< 0{return _f .New ("\u006e\u0065\u0067\u0061\u0074\u0069\u0076\u0065\u0020\u0076a\u006c\u0075\u0065\u0020\u0066\u006f\u0072 \u004d\u0061\u0072\u0067\u0069\u006e\u0052\u0069\u0067\u0068\u0074"); -};};if _be .PageSize !=nil &&!_be .PageSize .IsAPageSize (){return _f .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0070\u0061\u0067\u0065 \u0073\u0069\u007a\u0065");};return nil ;}; +// PageParameters are the query parameters used in the PDF generation. +type PageParameters struct{ -// MarginLeft sets up the MarginLeft parameter for the query. -func (_fcd *QueryBuilder )MarginLeft (marginLeft _ae .Length )*QueryBuilder {_fcd ._gaa .PageParameters .MarginLeft =marginLeft ;return _fcd ;}; +// PaperWidth sets the width of the paper. +PaperWidth _b .Length `schema:"paper-width" json:"paperWidth"`; -// BuildHTMLQuery creates a Query builder that is supposed to create valid -func BuildHTMLQuery ()*QueryBuilder {return &QueryBuilder {}}; +// PaperHeight is the height of the output paper. +PaperHeight _b .Length `schema:"paper-height" json:"paperHeight"`; -// PDFResponse is the response used by the HTMLConverter. -type PDFResponse struct{ID string `json:"id"`;Data []byte `json:"data"`;}; +// PageSize is the page size string. +PageSize *_b .PageSize `schema:"page-size" json:"pageSize"`; -// TimeoutDuration sets the server query duration timeout. -// Once the timeout is reached the server will return an error. -func (_gafe *QueryBuilder )TimeoutDuration (d _d .Duration )*QueryBuilder {_gafe ._gaa .TimeoutDuration =d ;return _gafe ;};func (_cbf *Client )setQueryValues (_dfb *_fc .Request ,_edd *Query ){_gdg :=_dfb .URL .Query ();_fe :=_edd .PageParameters ;if _fe .PageSize !=nil {_gdg .Set ("\u0070a\u0067\u0065\u002d\u0073\u0069\u007ae",_fe .PageSize .String ()); -};if _fe .PaperHeight !=nil {_gdg .Set ("\u0070\u0061\u0070e\u0072\u002d\u0068\u0065\u0069\u0067\u0068\u0074",_fe .PaperHeight .String ());};if _fe .PaperWidth !=nil {_gdg .Set ("p\u0061\u0070\u0065\u0072\u002d\u0077\u0069\u0064\u0074\u0068",_fe .PaperWidth .String ()); -};if _fe .MarginTop !=nil {_gdg .Set ("\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0074\u006f\u0070",_fe .MarginTop .String ());};if _fe .MarginBottom !=nil {_gdg .Set ("\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0062\u006f\u0074\u0074\u006f\u006d",_fe .MarginBottom .String ()); -};if _fe .MarginRight !=nil {_gdg .Set ("\u006d\u0061\u0072g\u0069\u006e\u002d\u0072\u0069\u0067\u0068\u0074",_fe .MarginRight .String ());};if _fe .MarginLeft !=nil {_gdg .Set ("m\u0061\u0072\u0067\u0069\u006e\u002d\u006c\u0065\u0066\u0074",_fe .MarginLeft .String ()); -};if _fe .Orientation ==_ae .Landscape {_gdg .Set ("o\u0072\u0069\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e",_fe .Orientation .String ());};if _edd .RenderParameters .WaitTime !=0{_gdg .Set ("\u006d\u0069\u006e\u0069\u006d\u0075\u006d\u002d\u006c\u006f\u0061\u0064-\u0074\u0069\u006d\u0065",_ged .FormatInt (int64 (_edd .RenderParameters .WaitTime /_d .Millisecond ),10)); -};_dfb .URL .RawQuery =_gdg .Encode ();}; +// Orientation defines if the output should be in a landscape format. +Orientation _b .Orientation `schema:"orientation" json:"orientation"`; -// Validate checks if provided Query is valid. -func (_dg *Query )Validate ()error {switch _dg .Method {case "\u0077\u0065\u0062":if _dg .URL ==""{return ErrMissingData ;};case "\u0064\u0069\u0072","\u0068\u0074\u006d\u006c":if len (_dg .Content )==0{return ErrMissingData ;};if _dg .ContentType ==""{return ErrContentType ; -};default:return _eg .Errorf ("\u0075\u006e\u0064ef\u0069\u006e\u0065\u0064\u0020\u0063\u006f\u006e\u0074e\u006et\u0020q\u0075e\u0072\u0079\u0020\u006d\u0065\u0074\u0068\u006f\u0072\u003a\u0020\u0025\u0073",_dg .Method );};if _acg :=_dg .PageParameters .Validate (); -_acg !=nil {return _acg ;};if _bef :=_dg .RenderParameters .Validate ();_bef !=nil {return _bef ;};return nil ;}; +// MarginTop sets up the Top Margin for the output. +MarginTop _b .Length `schema:"margin-top" json:"marginTop"`; -// Orientation sets the page orientation for the Query. -func (_efc *QueryBuilder )Orientation (orientation _ae .Orientation )*QueryBuilder {_efc ._gaa .PageParameters .Orientation =orientation ;return _efc ;}; +// MarginBottom sets up the Bottom Margin for the output. +MarginBottom _b .Length `schema:"margin-bottom" json:"marginBottom"`; -// WithHostname sets the Hostname option for the client options. -func WithHostname (option string )Option {return func (_dff *Options ){_dff .Hostname =option }};var (ErrMissingData =_f .New ("\u006di\u0073s\u0069\u006e\u0067\u0020\u0069n\u0070\u0075t\u0020\u0064\u0061\u0074\u0061");ErrContentType =_f .New ("i\u006ev\u0061\u006c\u0069\u0064\u0020\u0063\u006f\u006et\u0065\u006e\u0074\u0020ty\u0070\u0065"); -ErrContentTypeDeclared =_f .New ("\u0063\u006f\u006e\u0074\u0065\u006e\u0074\u0020\u0074\u0079\u0070\u0065\u0020\u0069\u0073 \u0061l\u0072\u0065\u0061\u0064\u0079\u0020\u0064\u0065\u0063\u006c\u0061\u0072\u0065\u0064");); +// MarginLeft sets up the Left Margin for the output. +MarginLeft _b .Length `schema:"margin-left" json:"marginLeft"`; -// DefaultPageParameters creates default parameters. -func DefaultPageParameters ()PageParameters {return PageParameters {Orientation :_ae .Portrait }}; +// MarginRight sets up the Right Margin for the output. +MarginRight _b .Length `schema:"margin-right" json:"marginRight"`;}; -// BySelector is a structure that defines a selector with it's query 'by' type. -type BySelector struct{Selector string `json:"selector"`;By _gedc .ByType `json:"by"`;}; +// Validate checks validity of the selector. +func (_ecg BySelector )Validate ()error {if _ecg .Selector ==""{return _g .New ("\u0070\u0072\u006fvi\u0064\u0065\u0064\u0020\u0065\u006d\u0070\u0074\u0079\u0020\u0073\u0065\u006c\u0065\u0063\u0074\u006f\u0072");};if _ega :=_ecg .By .Validate ();_ega !=nil {return _ega ; +};return nil ;}; -// Err gets the error which could occur in the query. -func (_efg *QueryBuilder )Err ()error {return _efg ._gee }; +// Query is a structure that contains query parameters and the content used for the HTMLConverter conversion process. +type Query struct{Content []byte ;ContentType string ;URL string ;Method string ;PageParameters PageParameters ;RenderParameters RenderParameters ;TimeoutDuration _f .Duration ;}; -// Option is a function that changes client options. -type Option func (_age *Options ); +// WaitReady waits for the selector to get ready - 'loaded'. +func (_aae *QueryBuilder )WaitReady (selector string ,by _dbe .ByType )*QueryBuilder {_aae ._agg .RenderParameters .WaitReady =append (_aae ._agg .RenderParameters .WaitReady ,BySelector {Selector :selector ,By :by });return _aae ;}; -// Validate checks if the QueryBuilder had no errors during composition and creation. -func (_ab *QueryBuilder )Validate ()error {if _ab ._gee !=nil {return _ab ._gee ;};return _ab ._gaa .Validate ();}; +// TimeoutDuration sets the server query duration timeout. +// Once the timeout is reached the server will return an error. +func (_eedb *QueryBuilder )TimeoutDuration (d _f .Duration )*QueryBuilder {_eedb ._agg .TimeoutDuration =d ;return _eedb ;}; -// PageParameters are the query parameters used in the PDF generation. -type PageParameters struct{ +// PaperHeight sets up the PaperHeight (in cm) parameter for the query. +func (_aac *QueryBuilder )PaperHeight (paperHeight _b .Length )*QueryBuilder {_aac ._agg .PageParameters .PaperHeight =paperHeight ;return _aac ;}; -// PaperWidth sets the width of the paper. -PaperWidth _ae .Length `schema:"paper-width" json:"paperWidth"`; +// MarginLeft sets up the MarginLeft parameter for the query. +func (_agf *QueryBuilder )MarginLeft (marginLeft _b .Length )*QueryBuilder {_agf ._agg .PageParameters .MarginLeft =marginLeft ;return _agf ;}; -// PaperHeight is the height of the output paper. -PaperHeight _ae .Length `schema:"paper-height" json:"paperHeight"`; +// Options are the client options used by the HTTP client. +type Options struct{HTTPS bool ;Hostname string ;Port int ;DefaultTimeout _f .Duration ;Prefix string ;}; -// PageSize is the page size string. -PageSize *_ae .PageSize `schema:"page-size" json:"pageSize"`; +// Client is a structure that is a HTTP client for the unihtml server. +type Client struct{Options Options ;Client *_dee .Client ;}; -// Orientation defines if the output should be in a landscape format. -Orientation _ae .Orientation `schema:"orientation" json:"orientation"`; +// WithHTTPS sets the TLS option for the client options. +func WithHTTPS (useHTTPS bool )Option {return func (_cee *Options ){_cee .HTTPS =useHTTPS }}; -// MarginTop sets up the Top Margin for the output. -MarginTop _ae .Length `schema:"margin-top" json:"marginTop"`; +// WithPort sets the Port option for the client options. +func WithPort (option int )Option {return func (_cce *Options ){_cce .Port =option }}; -// MarginBottom sets up the Bottom Margin for the output. -MarginBottom _ae .Length `schema:"margin-bottom" json:"marginBottom"`; +// DefaultPageParameters creates default parameters. +func DefaultPageParameters ()PageParameters {return PageParameters {Orientation :_b .Portrait }}; -// MarginLeft sets up the Left Margin for the output. -MarginLeft _ae .Length `schema:"margin-left" json:"marginLeft"`; +// Validate checks if the parameters are valid. +func (_eed *PageParameters )Validate ()error {if _eed .PaperWidth !=nil {if _eed .PaperWidth .Millimeters ()< 0{return _g .New ("\u006e\u0065g\u0061\u0074\u0069\u0076\u0065\u0020\u0076\u0061\u006c\u0075\u0065\u0020\u0066\u006f\u0072\u0020\u0050\u0061\u0070\u0065\u0072\u0057id\u0074\u0068"); +};};if _eed .PaperHeight !=nil {if _eed .PaperHeight .Millimeters ()< 0{return _g .New ("\u006e\u0065\u0067\u0061\u0074\u0069\u0076\u0065\u0020\u0076a\u006c\u0075\u0065\u0020\u0066\u006f\u0072 \u0050\u0061\u0070\u0065\u0072\u0048\u0065\u0069\u0067\u0068\u0074"); +};};if _eed .MarginTop !=nil {if _eed .MarginTop .Millimeters ()< 0{return _g .New ("\u006e\u0065\u0067\u0061t\u0069\u0076\u0065\u0020\u0076\u0061\u006c\u0075\u0065\u0020f\u006fr\u0020\u004d\u0061\u0072\u0067\u0069\u006eT\u006f\u0070");};};if _eed .MarginBottom !=nil {if _eed .MarginBottom .Millimeters ()< 0{return _g .New ("\u006e\u0065\u0067a\u0074\u0069\u0076\u0065 \u0076\u0061\u006c\u0075\u0065\u0020\u0066o\u0072\u0020\u004d\u0061\u0072\u0067\u0069\u006e\u0042\u006f\u0074\u0074\u006f\u006d"); +};};if _eed .MarginLeft !=nil {if _eed .MarginLeft .Millimeters ()< 0{return _g .New ("\u006e\u0065g\u0061\u0074\u0069\u0076\u0065\u0020\u0076\u0061\u006c\u0075\u0065\u0020\u0066\u006f\u0072\u0020\u004d\u0061\u0072\u0067\u0069\u006eLe\u0066\u0074");};}; +if _eed .MarginRight !=nil {if _eed .MarginRight .Millimeters ()< 0{return _g .New ("\u006e\u0065\u0067\u0061\u0074\u0069\u0076\u0065\u0020\u0076a\u006c\u0075\u0065\u0020\u0066\u006f\u0072 \u004d\u0061\u0072\u0067\u0069\u006e\u0052\u0069\u0067\u0068\u0074"); +};};if _eed .PageSize !=nil &&!_eed .PageSize .IsAPageSize (){return _g .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0070\u0061\u0067\u0065 \u0073\u0069\u007a\u0065");};return nil ;}; -// MarginRight sets up the Right Margin for the output. -MarginRight _ae .Length `schema:"margin-right" json:"marginRight"`;}; +// Addr gets the HTTP address URI used by the http.Client. +func (_eeg *Options )Addr ()string {_afc :=_ca .Builder {};_afc .WriteString ("\u0068\u0074\u0074\u0070");if _eeg .HTTPS {_afc .WriteRune ('s');};_afc .WriteString ("\u003a\u002f\u002f");_afc .WriteString (_eeg .Hostname );_afc .WriteRune (':');_afc .WriteString (_eb .Itoa (_eeg .Port )); +if _eeg .Prefix !=""{_afc .WriteString (_eeg .Prefix );};return _afc .String ();}; -// QueryBuilder is the query that converts HTMLConverter defined data -type QueryBuilder struct{_gaa Query ;_gee error ;}; +// PageSize sets up the PageSize parameter for the query. +func (_bfcb *QueryBuilder )PageSize (pageSize _b .PageSize )*QueryBuilder {if pageSize !=_b .Undefined {_bfcb ._agg .PageParameters .PageSize =&pageSize ;};return _bfcb ;}; -// ConvertHTML converts provided Query input into PDF file data. -// Implements creator.HTMLConverter interface. -func (_gg *Client )ConvertHTML (ctx _a .Context ,q *Query )(*PDFResponse ,error ){if _bf :=q .Validate ();_bf !=nil {return nil ,_bf ;};_eb ,_gaf :=_gg .getGenerateRequest (ctx ,q );if _gaf !=nil {return nil ,_gaf ;};_gb .Log .Trace ("\u0052\u0065\u0071\u0075\u0065\u0073\u0074 \u002d\u0020\u0025s\u0020\u002d\u0020\u0025s\u0025\u0073\u002c\u0020\u0048\u0065\u0061\u0064\u0065\u0072\u0073\u003a\u0020\u0025\u0076\u002c\u0020\u0051\u0075\u0065\u0072\u0079\u003a\u0020\u0025\u0076",_eb .Method ,_eb .URL .Hostname (),_eb .URL .Path ,_eb .Header ,_eb .URL .Query ()); -_cd :=*_gg .Client ;if q .TimeoutDuration !=0{_cd .Timeout =q .TimeoutDuration ;};_gd ,_gaf :=_cd .Do (_eb );if _gaf !=nil {return nil ,_gaf ;};var _gef error ;switch _gd .StatusCode {case _fc .StatusNotFound :_gef =ErrNotFound ;case _fc .StatusBadRequest :_gef =ErrBadRequest ; -case _fc .StatusNotImplemented :_gef =ErrNotImplemented ;case _fc .StatusUnauthorized :_gef =ErrUnauthorized ;case _fc .StatusRequestTimeout :_gef =ErrTimedOut ;case _fc .StatusCreated :default:_gef =ErrInternalError ;};_ba :=_gd .Body ;switch _gd .Header .Get ("\u0043\u006fn\u0074\u0065\u006et\u002d\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067"){case "\u0067\u007a\u0069\u0070":_ba ,_gaf =_af .NewReader (_gd .Body ); -if _gaf !=nil {return nil ,_gaf ;};case "\u0064e\u0066\u006c\u0061\u0074\u0065":_ba =_ge .NewReader (_gd .Body );case "":default:return nil ,_eg .Errorf ("\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0043o\u006e\u0074\u0065\u006e\u0074\u002dE\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u003a\u0020\u0025\u0073\u0020\u0068e\u0061\u0064\u0065\u0072",_gd .Header .Get ("\u0043\u006fn\u0074\u0065\u006et\u002d\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067")); -};_fge ,_gaf :=_c .ReadAll (_ba );if _gaf !=nil &&_gef ==nil {return nil ,_eg .Errorf ("\u0055\u006e\u0069HT\u004d\u004c\u0020\u0073\u0065\u0072\u0076\u0065\u0072\u0020\u0065\u0072\u0072\u006f\u0072\u0020\u0025\u0073",_gaf );};_gb .Log .Trace ("\u005b\u0025\u0064]\u0020\u0025\u0073\u0020\u0025\u0073\u0025\u0073",_gd .StatusCode ,_eb .Method ,_eb .URL .Host ,_eb .URL .Path ); -if _gef !=nil {return nil ,_eg .Errorf ("\u0025\u0073\u0020%\u0077",string (_fge ),_gef );};_acc :=_gd .Header .Get ("\u0058\u002d\u004a\u006f\u0062\u002d\u0049\u0044");_gb .Log .Trace ("\u0052\u0065\u0073\u0070\u006f\u006e\u0073\u0065\u0020I\u0044\u0020\u0025\u0073",_acc ); -return &PDFResponse {ID :_acc ,Data :_fge },nil ;}; +// BuildHTMLQuery creates a Query builder that is supposed to create valid +func BuildHTMLQuery ()*QueryBuilder {return &QueryBuilder {}}; + +// WithDefaultTimeout sets the DefaultTimeout option for the client options. +func WithDefaultTimeout (option _f .Duration )Option {return func (_be *Options ){_be .DefaultTimeout =option };};var (ErrNotFound =_g .New ("\u006eo\u0074\u0020\u0066\u006f\u0075\u006ed");ErrBadRequest =_g .New ("b\u0061\u0064\u0020\u0072\u0065\u0071\u0075\u0065\u0073\u0074"); +ErrNotImplemented =_g .New ("\u006eo\u0074 \u0069\u006d\u0070\u006c\u0065\u006d\u0065\u006e\u0074\u0065\u0064");ErrInternalError =_g .New ("i\u006e\u0074\u0065\u0072na\u006c \u0073\u0065\u0072\u0076\u0065r\u0020\u0065\u0072\u0072\u006f\u0072");ErrBadGateway =_g .New ("b\u0061\u0064\u0020\u0067\u0061\u0074\u0065\u0077\u0061\u0079"); +ErrUnauthorized =_g .New ("\u0075\u006e\u0061u\u0074\u0068\u006f\u0072\u0069\u007a\u0065\u0064");ErrTimedOut =_g .New ("\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0020\u0074\u0069\u006d\u0065d\u0020\u006f\u0075\u0074");); // New creates new client with provided options. -func New (o Options )*Client {o .DefaultTimeout =_d .Second *30;if o .Port <=0{o .Port =8080;};if o .Hostname ==""{o .Hostname ="\u00312\u0037\u002e\u0030\u002e\u0030\u002e1";};var _dd =&_fc .Transport {DialContext :(&_e .Dialer {Timeout :5*_d .Second }).DialContext ,TLSHandshakeTimeout :5*_d .Second }; -_gb .Log .Info ("\u0043l\u0069e\u006e\u0074\u0020\u0041\u0064\u0064\u0072\u003a\u0020\u0025\u0073",o .Addr ());return &Client {Options :o ,Client :&_fc .Client {Transport :_dd ,Timeout :o .DefaultTimeout }};}; +func New (o Options )*Client {o .DefaultTimeout =_f .Second *30;if o .Port <=0{o .Port =8080;};if o .Hostname ==""{o .Hostname ="\u00312\u0037\u002e\u0030\u002e\u0030\u002e1";};var _acb =&_dee .Transport {DialContext :(&_af .Dialer {Timeout :5*_f .Second }).DialContext ,TLSHandshakeTimeout :5*_f .Second }; +_da .Log .Info ("\u0043l\u0069e\u006e\u0074\u0020\u0041\u0064\u0064\u0072\u003a\u0020\u0025\u0073",o .Addr ());return &Client {Options :o ,Client :&_dee .Client {Transport :_acb ,Timeout :o .DefaultTimeout }};}; -// Query is a structure that contains query parameters and the content used for the HTMLConverter conversion process. -type Query struct{Content []byte ;ContentType string ;URL string ;Method string ;PageParameters PageParameters ;RenderParameters RenderParameters ;TimeoutDuration _d .Duration ;}; +// MarginRight sets up the MarginRight parameter for the query. +func (_aaa *QueryBuilder )MarginRight (marginRight _b .Length )*QueryBuilder {_aaa ._agg .PageParameters .MarginRight =marginRight ;return _aaa ;}; -// Options are the client options used by the HTTP client. -type Options struct{HTTPS bool ;Hostname string ;Port int ;DefaultTimeout _d .Duration ;Prefix string ;}; +// WaitTime sets the minimum load time parameter for the page rendering. +func (_bcc *QueryBuilder )WaitTime (d _f .Duration )*QueryBuilder {_bcc ._agg .RenderParameters .WaitTime =d ;return _bcc ;}; -// Portrait sets up the portrait page orientation. -func (_gf *QueryBuilder )Portrait ()*QueryBuilder {_gf ._gaa .PageParameters .Orientation =_ae .Portrait ;return _gf ;}; +// Err gets the error which could occur in the query. +func (_fbg *QueryBuilder )Err ()error {return _fbg ._fgb };func (_dc *Client )getGenerateRequest (_dfb _df .Context ,_gded *Query )(*_dee .Request ,error ){_bf :=generatePDFRequestV1 {Method :_gded .Method ,PageParameters :_gded .PageParameters ,RenderParameters :_gded .RenderParameters ,TimeoutDuration :int64 (_gded .TimeoutDuration )}; +switch _gded .Method {case "\u0077\u0065\u0062":_bf .ContentURL =_gded .URL ;case "\u0064\u0069\u0072","\u0068\u0074\u006d\u006c":_bf .ContentType =_gded .ContentType ;_bf .Content =_gded .Content ;};_ff :=new (_aa .Buffer );if _acbd :=_c .NewEncoder (_ff ).Encode (&_bf ); +_acbd !=nil {return nil ,_ac .Errorf ("e\u006e\u0063\u006f\u0064\u0069\u006eg\u0020\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0020f\u0061\u0069\u006ce\u0064:\u0020\u0025\u0076",_acbd );};_ffd :=_dc .Options .Addr ();_ffd =_ac .Sprintf ("%\u0073\u002f\u0062\u0065\u0074\u0061\u002f\u0070\u0064\u0066",_ffd ); +_bd ,_fed :=_dee .NewRequest ("\u0050\u004f\u0053\u0054",_ffd ,_ff );if _fed !=nil {return nil ,_fed ;};_bd .Header .Set ("\u0043\u006f\u006et\u0065\u006e\u0074\u002d\u0054\u0079\u0070\u0065","\u0061\u0070p\u006c\u0069\u0063a\u0074\u0069\u006f\u006e\u002f\u006a\u0073\u006f\u006e"); +_bd .Header .Set ("\u0041c\u0063e\u0070\u0074\u002d\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067","\u0064\u0065\u0066\u006ca\u0074\u0065\u002c\u0020\u0067\u007a\u0069\u0070\u003b\u0071=\u0031.\u0030\u002c\u0020\u002a\u003b\u0071\u003d0\u002e\u0035"); +_bd =_bd .WithContext (_dfb );return _bd ,nil ;}; -// WithDefaultTimeout sets the DefaultTimeout option for the client options. -func WithDefaultTimeout (option _d .Duration )Option {return func (_gdc *Options ){_gdc .DefaultTimeout =option };}; +// PDFResponse is the response used by the HTMLConverter. +type PDFResponse struct{ID string `json:"id"`;Data []byte `json:"data"`;}; -// RenderParameters are the parameters related with the rendering. -type RenderParameters struct{WaitTime _d .Duration `schema:"minimum-load-time" json:"waitTime"`;WaitReady []BySelector `json:"waitReady"`;WaitVisible []BySelector `json:"waitVisible"`;}; +// Landscape sets up the landscape portrait orientation. +func (_dcd *QueryBuilder )Landscape ()*QueryBuilder {_dcd ._agg .PageParameters .Orientation =_b .Landscape ;return _dcd ;}; -// WithPrefix sets the client prefix. -func WithPrefix (prefix string )Option {return func (_gae *Options ){_gae .Prefix =prefix }}; +// MarginBottom sets up the MarginBottom parameter for the query. +func (_febb *QueryBuilder )MarginBottom (marginBottom _b .Length )*QueryBuilder {_febb ._agg .PageParameters .MarginBottom =marginBottom ;return _febb ;}; -// WaitReady waits for the selector to get ready - 'loaded'. -func (_eeg *QueryBuilder )WaitReady (selector string ,by _gedc .ByType )*QueryBuilder {_eeg ._gaa .RenderParameters .WaitReady =append (_eeg ._gaa .RenderParameters .WaitReady ,BySelector {Selector :selector ,By :by });return _eeg ;}; +// Query gets the Query from provided query builder. If some error occurred during build process +// or the input is not valid the function would return an error. +func (_gbf *QueryBuilder )Query ()(*Query ,error ){if _bfc :=_gbf .Validate ();_bfc !=nil {return nil ,_bfc ;};return &_gbf ._agg ,nil ;};var (ErrMissingData =_g .New ("\u006di\u0073s\u0069\u006e\u0067\u0020\u0069n\u0070\u0075t\u0020\u0064\u0061\u0074\u0061"); +ErrContentType =_g .New ("i\u006ev\u0061\u006c\u0069\u0064\u0020\u0063\u006f\u006et\u0065\u006e\u0074\u0020ty\u0070\u0065");ErrContentTypeDeclared =_g .New ("\u0063\u006f\u006e\u0074\u0065\u006e\u0074\u0020\u0074\u0079\u0070\u0065\u0020\u0069\u0073 \u0061l\u0072\u0065\u0061\u0064\u0079\u0020\u0064\u0065\u0063\u006c\u0061\u0072\u0065\u0064"); +); -// Validate checks validity of the selector. -func (_bfb BySelector )Validate ()error {if _bfb .Selector ==""{return _f .New ("\u0070\u0072\u006fvi\u0064\u0065\u0064\u0020\u0065\u006d\u0070\u0074\u0079\u0020\u0073\u0065\u006c\u0065\u0063\u0074\u006f\u0072");};if _afd :=_bfb .By .Validate ();_afd !=nil {return _afd ; -};return nil ;}; +// Validate checks if the QueryBuilder had no errors during composition and creation. +func (_gbd *QueryBuilder )Validate ()error {if _gbd ._fgb !=nil {return _gbd ._fgb ;};return _gbd ._agg .Validate ();}; // WaitVisible waits for the selector to get visible. -func (_cad *QueryBuilder )WaitVisible (selector string ,by _gedc .ByType )*QueryBuilder {_cad ._gaa .RenderParameters .WaitVisible =append (_cad ._gaa .RenderParameters .WaitVisible ,BySelector {Selector :selector ,By :by });return _cad ;}; +func (_ceea *QueryBuilder )WaitVisible (selector string ,by _dbe .ByType )*QueryBuilder {_ceea ._agg .RenderParameters .WaitVisible =append (_ceea ._agg .RenderParameters .WaitVisible ,BySelector {Selector :selector ,By :by });return _ceea ;}; -// WithPort sets the Port option for the client options. -func WithPort (option int )Option {return func (_ef *Options ){_ef .Port =option }}; - -// PageSize sets up the PageSize parameter for the query. -func (_fb *QueryBuilder )PageSize (pageSize _ae .PageSize )*QueryBuilder {if pageSize !=_ae .Undefined {_fb ._gaa .PageParameters .PageSize =&pageSize ;};return _fb ;}; \ No newline at end of file +// Orientation sets the page orientation for the Query. +func (_dbb *QueryBuilder )Orientation (orientation _b .Orientation )*QueryBuilder {_dbb ._agg .PageParameters .Orientation =orientation ;return _dbb ;}; \ No newline at end of file diff --git a/common/common.go b/common/common.go index ae303be..2255714 100644 --- a/common/common.go +++ b/common/common.go @@ -10,8 +10,8 @@ // terms that can be accessed at https://unidoc.io/eula/ // Package common contains common properties used by the subpackages. -package common ;import _b "time";const Version ="\u0030\u002e\u0037.\u0030"; +package common ;import _bb "time"; // UtcTimeFormat returns a formatted string describing a UTC timestamp. -func UtcTimeFormat (t _b .Time )string {return t .Format (_ga )+"\u0020\u0055\u0054\u0043"};var ReleasedAt =_b .Date (_gf ,_f ,_be ,_e ,_ba ,0,0,_b .UTC );const _gf =2023;const _e =12;const _f =2;const _ga ="\u0032\u0020\u004aan\u0075\u0061\u0072\u0079\u0020\u0032\u0030\u0030\u0036\u0020\u0061\u0074\u0020\u0031\u0035\u003a\u0030\u0034"; -const _be =10;const _ba =20; \ No newline at end of file +func UtcTimeFormat (t _bb .Time )string {return t .Format (_a )+"\u0020\u0055\u0054\u0043"};const _e =26;const _a ="\u0032\u0020\u004aan\u0075\u0061\u0072\u0079\u0020\u0032\u0030\u0030\u0036\u0020\u0061\u0074\u0020\u0031\u0035\u003a\u0030\u0034";const _c =2024; +const _g =1;const _ea =12;var ReleasedAt =_bb .Date (_c ,_g ,_e ,_ea ,_d ,0,0,_bb .UTC );const _d =20;const Version ="\u0030\u002e\u0038.\u0030"; \ No newline at end of file diff --git a/content/content.go b/content/content.go index 9a9fc61..7ebf199 100644 --- a/content/content.go +++ b/content/content.go @@ -9,50 +9,65 @@ // Use of this source code is governed by the UniDoc End User License Agreement // terms that can be accessed at https://unidoc.io/eula/ -package content ;import (_d "archive/zip";_fa "bytes";_f "fmt";_c "io/ioutil";_a "net/url";_b "os";_g "strings";); +package content ;import (_ff "archive/zip";_d "bytes";_e "fmt";_g "io/ioutil";_c "net/url";_be "os";_b "strings";); // ContentType implements Content interface. -func (_bac *zipDirectory )ContentType ()string {return "\u0061p\u0070l\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u007a\u0069\u0070";}; +func (_cff *zipDirectory )ContentType ()string {return "\u0061p\u0070l\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u007a\u0069\u0070";}; -// Data implements Content interface. -func (_ef *webURL )Data ()[]byte {return []byte (_ef ._fb )};type webURL struct{_fb string }; +// StringContent implements Content interface for an HTML string. +type StringContent struct{_aag string };type htmlFile struct{_fe _d .Buffer }; -// ContentType implements Content interface. -func (_ge *webURL )ContentType ()string {return "\u0074\u0065\u0078\u0074\u002f\u0070\u006c\u0061\u0069\u006e";}; +// NewHTMLFile creates new Content htmFile for provided input path. +func NewHTMLFile (path string )(Content ,error ){_ge ,_fb :=_be .Open (path );if _fb !=nil {return nil ,_fb ;};_a :=&htmlFile {_fe :_d .Buffer {}};if _ ,_fb =_a ._fe .ReadFrom (_ge );_fb !=nil {return nil ,_fb ;};return _a ,nil ;};type webURL struct{_bf string }; +type zipDirectory struct{_bc _d .Buffer ;_ad *_ff .Writer ;}; -// NewWebURL creates new Content webURL for provided input URL path. -func NewWebURL (path string )(Content ,error ){if _ ,_dc :=_a .Parse (path );_dc !=nil {return nil ,_dc ;};return &webURL {_fb :path },nil ;}; +// Method gets the web url query method. +func (_aa *webURL )Method ()string {return "\u0077\u0065\u0062"}; -// NewZipDirectory creates new zip compressed file that recursively reads the directory at the 'dirPath' -// and stores in it's in-memory buffer. -func NewZipDirectory (dirPath string )(Content ,error ){_fd :=&zipDirectory {_ga :_fa .Buffer {}};_fd ._gb =_d .NewWriter (&_fd ._ga );if _bb :=_fd .zipPath (dirPath ,"");_bb !=nil {return nil ,_bb ;};if _ee :=_fd ._gb .Close ();_ee !=nil {return nil ,_ee ; -};return _fd ,nil ;}; +// Content is an interface used for putting the content into Client Query. +type Content interface{ContentType ()string ;Method ()string ;Data ()[]byte ;};func (_adg *zipDirectory )zipPath (_aaa ,_aaf string )error {_ac ,_fa :=_g .ReadDir (_aaa );if _fa !=nil {return _e .Errorf ("\u0072\u0065\u0061di\u006e\u0067\u0020\u0064\u0069\u0072\u0065\u0063\u0074o\u0072y\u003a \u0027%\u0073\u0027\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u003a\u0020\u0025\u0077",_aaa ,_fa ); +};_df :=&_b .Builder {};for _ ,_ag :=range _ac {_bgb ,_dc :=_adg .zipBasePaths (_ag ,_aaa ,_aaf ,_ag .IsDir (),_df );if _ag .IsDir (){if _dg :=_adg .zipPath (_bgb ,_dc );_dg !=nil {return _dg ;};continue ;};_gg ,_fc :=_g .ReadFile (_bgb );if _fc !=nil {return _fc ; +};_def ,_fc :=_adg ._ad .Create (_dc );if _fc !=nil {return _fc ;};if _ ,_fc =_def .Write (_gg );_fc !=nil {return _fc ;};};return nil ;}; -// Method gets the query method. -func (_aa *htmlFile )Method ()string {return "\u0068\u0074\u006d\u006c"}; +// Method implements Content interface. +func (_faa *StringContent )Method ()string {return "\u0068\u0074\u006d\u006c"}; -// ContentType implements Content interface. -func (_ba *htmlFile )ContentType ()string {return "\u0074e\u0078\u0074\u002f\u0068\u0074\u006dl"}; +// Data implements Content interface. +func (_cd *StringContent )Data ()[]byte {return []byte (_cd ._aag )}; // Data implements Content interface. -func (_ea *zipDirectory )Data ()[]byte {return _ea ._ga .Bytes ()}; +func (_de *htmlFile )Data ()[]byte {return _de ._fe .Bytes ()}; -// Method gets the zip directory method. -func (_efc *zipDirectory )Method ()string {return "\u0064\u0069\u0072"}; +// Data implements Content interface. +func (_gef *zipDirectory )Data ()[]byte {return _gef ._bc .Bytes ()}; -// Method gets the web url query method. -func (_da *webURL )Method ()string {return "\u0077\u0065\u0062"};func (_cb *zipDirectory )zipBasePaths (_df _b .FileInfo ,_eg ,_dce string ,_fe bool ,_ffa *_g .Builder )(string ,string ){_ffa .WriteString (_eg );if !_g .HasSuffix (_eg ,"\u002f"){_ffa .WriteRune ('/'); -};_ffa .WriteString (_df .Name ());if _fe {_ffa .WriteRune ('/');};_fc :=_ffa .String ();_ffa .Reset ();_ffa .WriteString (_dce );_ffa .WriteString (_df .Name ());if _fe {_ffa .WriteRune ('/');};_fcb :=_ffa .String ();_ffa .Reset ();return _fc ,_fcb ;}; +// ContentType implements Content interface. +func (_bce *StringContent )ContentType ()string {return "\u0074e\u0078\u0074\u002f\u0068\u0074\u006dl";}; +// NewStringContent creates a new StringContent. +func NewStringContent (html string )(*StringContent ,error ){return &StringContent {_aag :html },nil }; -// Content is an interface used for putting the content into Client Query. -type Content interface{ContentType ()string ;Method ()string ;Data ()[]byte ;}; +// ContentType implements Content interface. +func (_ab *htmlFile )ContentType ()string {return "\u0074e\u0078\u0074\u002f\u0068\u0074\u006dl"}; -// NewHTMLFile creates new Content htmFile for provided input path. -func NewHTMLFile (path string )(Content ,error ){_gfd ,_ca :=_b .Open (path );if _ca !=nil {return nil ,_ca ;};_bf :=&htmlFile {_gf :_fa .Buffer {}};if _ ,_ca =_bf ._gf .ReadFrom (_gfd );_ca !=nil {return nil ,_ca ;};return _bf ,nil ;};type zipDirectory struct{_ga _fa .Buffer ; -_gb *_d .Writer ;}; +// NewWebURL creates new Content webURL for provided input URL path. +func NewWebURL (path string )(Content ,error ){if _ ,_ec :=_c .Parse (path );_ec !=nil {return nil ,_ec ;};return &webURL {_bf :path },nil ;}; + +// ContentType implements Content interface. +func (_cg *webURL )ContentType ()string {return "\u0074\u0065\u0078\u0074\u002f\u0070\u006c\u0061\u0069\u006e";}; + +// Method gets the query method. +func (_ee *htmlFile )Method ()string {return "\u0068\u0074\u006d\u006c"}; // Data implements Content interface. -func (_ce *htmlFile )Data ()[]byte {return _ce ._gf .Bytes ()};type htmlFile struct{_gf _fa .Buffer };func (_aaa *zipDirectory )zipPath (_af ,_gg string )error {_dg ,_dd :=_c .ReadDir (_af );if _dd !=nil {return _f .Errorf ("\u0072\u0065\u0061di\u006e\u0067\u0020\u0064\u0069\u0072\u0065\u0063\u0074o\u0072y\u003a \u0027%\u0073\u0027\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u003a\u0020\u0025\u0077",_af ,_dd ); -};_ggd :=&_g .Builder {};for _ ,_eae :=range _dg {_cd ,_eb :=_aaa .zipBasePaths (_eae ,_af ,_gg ,_eae .IsDir (),_ggd );if _eae .IsDir (){if _cg :=_aaa .zipPath (_cd ,_eb );_cg !=nil {return _cg ;};continue ;};_gge ,_ed :=_c .ReadFile (_cd );if _ed !=nil {return _ed ; -};_dab ,_ed :=_aaa ._gb .Create (_eb );if _ed !=nil {return _ed ;};if _ ,_ed =_dab .Write (_gge );_ed !=nil {return _ed ;};};return nil ;}; \ No newline at end of file +func (_cf *webURL )Data ()[]byte {return []byte (_cf ._bf )};func (_gda *zipDirectory )zipBasePaths (_bd _be .FileInfo ,_fd ,_ea string ,_eaa bool ,_ggf *_b .Builder )(string ,string ){_ggf .WriteString (_fd );if !_b .HasSuffix (_fd ,"\u002f"){_ggf .WriteRune ('/'); +};_ggf .WriteString (_bd .Name ());if _eaa {_ggf .WriteRune ('/');};_fef :=_ggf .String ();_ggf .Reset ();_ggf .WriteString (_ea );_ggf .WriteString (_bd .Name ());if _eaa {_ggf .WriteRune ('/');};_bb :=_ggf .String ();_ggf .Reset ();return _fef ,_bb ; +}; + +// Method gets the zip directory method. +func (_ecf *zipDirectory )Method ()string {return "\u0064\u0069\u0072"}; + +// NewZipDirectory creates new zip compressed file that recursively reads the directory at the 'dirPath' +// and stores in it's in-memory buffer. +func NewZipDirectory (dirPath string )(Content ,error ){_ae :=&zipDirectory {_bc :_d .Buffer {}};_ae ._ad =_ff .NewWriter (&_ae ._bc );if _gd :=_ae .zipPath (dirPath ,"");_gd !=nil {return nil ,_gd ;};if _eg :=_ae ._ad .Close ();_eg !=nil {return nil ,_eg ; +};return _ae ,nil ;}; \ No newline at end of file diff --git a/go.mod b/go.mod index ebc88b0..24cb196 100644 --- a/go.mod +++ b/go.mod @@ -1,20 +1,46 @@ module github.com/unidoc/unihtml -go 1.15 +go 1.17 require ( - github.com/adrg/strutil v0.3.0 // indirect + github.com/mitchellh/go-homedir v1.1.0 + github.com/spf13/cobra v1.8.0 + github.com/spf13/viper v1.16.0 + github.com/stretchr/testify v1.8.4 + github.com/unidoc/unipdf/v3 v3.53.0 +) + +require ( + github.com/adrg/strutil v0.3.1 // indirect github.com/adrg/sysfont v0.1.2 // indirect github.com/adrg/xdg v0.4.0 // indirect - github.com/mitchellh/go-homedir v1.1.0 - github.com/sirupsen/logrus v1.8.1 // indirect - github.com/spf13/cobra v1.1.1 - github.com/spf13/viper v1.7.1 - github.com/unidoc/unipdf/v3 v3.34.0 - golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f // indirect - golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 // indirect - golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect - golang.org/x/text v0.3.7 // indirect - golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/gorilla/i18n v0.0.0-20150820051429-8b358169da46 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/pelletier/go-toml/v2 v2.1.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + github.com/unidoc/freetype v0.2.3 // indirect + github.com/unidoc/pkcs7 v0.2.0 // indirect + github.com/unidoc/timestamp v0.0.0-20200412005513-91597fd3793a // indirect + github.com/unidoc/unichart v0.3.0 // indirect + github.com/unidoc/unitype v0.4.0 // indirect + golang.org/x/crypto v0.18.0 // indirect + golang.org/x/image v0.15.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect + gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index dcc67e5..5935136 100644 --- a/go.sum +++ b/go.sum @@ -1,374 +1,114 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/adrg/strutil v0.1.0/go.mod h1:pXRr2+IyX5AEPAF5icj/EeTaiflPSD2hvGjnguilZgE= github.com/adrg/strutil v0.2.2/go.mod h1:EF2fjOFlGTepljfI+FzgTG13oXthR7ZAil9/aginnNQ= -github.com/adrg/strutil v0.3.0 h1:bi/HB2zQbDihC8lxvATDTDzkT4bG7PATtVnDYp5rvq4= -github.com/adrg/strutil v0.3.0/go.mod h1:Jz0wzBVE6Uiy9wxo62YEqEY1Nwto3QlLl1Il5gkLKWU= -github.com/adrg/sysfont v0.1.1/go.mod h1:19nTHzfIn/HbngFMet+yNAvwSQYtOJYMI7vWexLWyNw= +github.com/adrg/strutil v0.3.1 h1:OLvSS7CSJO8lBii4YmBt8jiK9QOtB9CzCzwl4Ic/Fz4= +github.com/adrg/strutil v0.3.1/go.mod h1:8h90y18QLrs11IBffcGX3NW/GFBXCMcNg4M7H6MspPA= github.com/adrg/sysfont v0.1.2 h1:MSU3KREM4RhsQ+7QgH7wPEPTgAgBIz0Hw6Nd4u7QgjE= github.com/adrg/sysfont v0.1.2/go.mod h1:6d3l7/BSjX9VaeXWJt9fcrftFaD/t7l11xgSywCPZGk= -github.com/adrg/xdg v0.2.1/go.mod h1:ZuOshBmzV4Ta+s23hdfFZnBsdzmoR3US0d7ErpqSbTQ= github.com/adrg/xdg v0.3.0/go.mod h1:7I2hH/IT30IsupOpKZ5ue7/qNi3CoKzD6tL3HwpaRMQ= github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls= github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/gorilla/i18n v0.0.0-20150820051429-8b358169da46 h1:N+R2A3fGIr5GucoRMu2xpqyQWQlfY31orbofBCdjMz8= +github.com/gorilla/i18n v0.0.0-20150820051429-8b358169da46/go.mod h1:2Yoiy15Cf7Q3NFwfaJquh7Mk1uGI09ytcD7CUhn8j7s= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4= -github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk= -github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= +github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/trimmer-io/go-xmp v1.0.0/go.mod h1:Aaptr9sp1lLv7UnCAdQ+gSHZyY2miYaKmcNVj7HRBwA= -github.com/unidoc/freetype v0.0.0-20220130190903-3efbeefd0c90 h1:Rk4easgDQslR3DK7vwtl6jYMZTF3JqZ3ceUdyT6a3UM= -github.com/unidoc/freetype v0.0.0-20220130190903-3efbeefd0c90/go.mod h1:mJ/Q7JnqEoWtajJVrV6S1InbRv0K/fJerPB5SQs32KI= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/unidoc/freetype v0.2.3 h1:uPqW+AY0vXN6K2tvtg8dMAtHTEvvHTN52b72XpZU+3I= +github.com/unidoc/freetype v0.2.3/go.mod h1:mJ/Q7JnqEoWtajJVrV6S1InbRv0K/fJerPB5SQs32KI= github.com/unidoc/pkcs7 v0.0.0-20200411230602-d883fd70d1df/go.mod h1:UEzOZUEpJfDpywVJMUT8QiugqEZC29pDq7kdIZhWCr8= -github.com/unidoc/pkcs7 v0.1.0 h1:9bQfbWMYsIfUP8PyhTcBudOsvbLpNH0MBv4U0P/jDTE= -github.com/unidoc/pkcs7 v0.1.0/go.mod h1:UEzOZUEpJfDpywVJMUT8QiugqEZC29pDq7kdIZhWCr8= +github.com/unidoc/pkcs7 v0.2.0 h1:0Y0RJR5Zu7OuD+/l7bODXARn6b8Ev2G4A8lI4rzy9kg= +github.com/unidoc/pkcs7 v0.2.0/go.mod h1:UEzOZUEpJfDpywVJMUT8QiugqEZC29pDq7kdIZhWCr8= github.com/unidoc/timestamp v0.0.0-20200412005513-91597fd3793a h1:RLtvUhe4DsUDl66m7MJ8OqBjq8jpWBXPK6/RKtqeTkc= github.com/unidoc/timestamp v0.0.0-20200412005513-91597fd3793a/go.mod h1:j+qMWZVpZFTvDey3zxUkSgPJZEX33tDgU/QIA0IzCUw= -github.com/unidoc/unichart v0.1.0 h1:GoJ/rxSoOYZsqlG3yOJpKkwgfsIQgb9hHX7bILZHcCg= -github.com/unidoc/unichart v0.1.0/go.mod h1:9sJXeqxIIsU2D07tmhpDMoND0mBFRGfKBJnXZMsJnzk= -github.com/unidoc/unipdf/v3 v3.34.0 h1:rTfnDuT1EMDR4QbxLsse/AtnZ7UJEar0vqZ/45SA+eM= -github.com/unidoc/unipdf/v3 v3.34.0/go.mod h1:rU+M1cSW0me6NOqQ471noVeEvQWhNBH3iUWkfFqJIgM= -github.com/unidoc/unitype v0.2.1 h1:x0jMn7pB/tNrjEVjy3Ukpxo++HOBQaTCXcTYFA6BH3w= -github.com/unidoc/unitype v0.2.1/go.mod h1:mafyug7zYmDOusqa7G0dJV45qp4b6TDAN+pHN7ZUIBU= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc= -golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +github.com/unidoc/unichart v0.3.0 h1:VX1j5yzhjrR3f2flC03Yat6/WF3h7Z+DLEvJLoTGhoc= +github.com/unidoc/unichart v0.3.0/go.mod h1:8JnLNKSOl8yQt1jXewNgYFHhFm5M6/ZiaydncFDpakA= +github.com/unidoc/unipdf/v3 v3.53.0 h1:xUgG/MH2iUHaar554w6OrL0qTKNy4AWzb19z0RyIExs= +github.com/unidoc/unipdf/v3 v3.53.0/go.mod h1:sEXO/chguUL1RAtyPnGos2BbCBGjL9dusmdT5b13eBg= +github.com/unidoc/unitype v0.4.0 h1:/TMZ3wgwfWWX64mU5x2O9no9UmoBqYCB089LYYqHyQQ= +github.com/unidoc/unitype v0.4.0/go.mod h1:HV5zuUeqMKA4QgYQq3KDlJY/P96XF90BQB+6czK6LVA= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 h1:LRtI4W37N+KFebI/qV0OFiLUv4GLOWeEW5hn/KEJvxE= -golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8= +golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 h1:nonptSpoQ4vQjyraW20DXPAglgQfVnM9ZC6MmNLMR60= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220731174439-a90be440212d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/selector/selector.go b/selector/selector.go index 97f80a6..3b66faf 100644 --- a/selector/selector.go +++ b/selector/selector.go @@ -9,11 +9,11 @@ // Use of this source code is governed by the UniDoc End User License Agreement // terms that can be accessed at https://unidoc.io/eula/ -package selector ;import _ff "errors"; +package selector ;import _g "errors"; // ByType is a 'By' selector type enumerator. type ByType uint ; // Validate checks validity of the ByType. -func (_b ByType )Validate ()error {if _b >=ByID &&_b <=BySearch {return nil ;};return _ff .New ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0062\u0079\u0020\u0073\u0065\u006c\u0065\u0063\u0074\u006f\u0072");};const (ByUndefined ByType =iota ;ByID ;ByQueryAll ; +func (_cg ByType )Validate ()error {if _cg >=ByID &&_cg <=BySearch {return nil ;};return _g .New ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0062\u0079\u0020\u0073\u0065\u006c\u0065\u0063\u0074\u006f\u0072");};const (ByUndefined ByType =iota ;ByID ;ByQueryAll ; ByQuery ;ByNodeID ;ByJSPath ;BySearch ;); \ No newline at end of file diff --git a/sizes/sizes.go b/sizes/sizes.go index ca1d9dd..407708d 100644 --- a/sizes/sizes.go +++ b/sizes/sizes.go @@ -12,190 +12,191 @@ // Package sizes defines basic types that determines the size units i.e. lengths. // // -package sizes ;import (_e "encoding/json";_b "flag";_a "fmt";_d "strconv";_bg "strings";);var (_ Length =Millimeter (0);); +package sizes ;import (_b "encoding/json";_g "flag";_ea "fmt";_c "strconv";_be "strings";); -// Set implements pflag.Value interface. -func (_eba *PageSize )Set (s string )error {_cca ,_aeb :=UnmarshalPageSize (s );if _aeb !=nil {return _aeb ;};*_eba =_cca ;return nil ;}; +// String gets the string value for given flag. +func (_ga *LengthFlag )String ()string {if _ga .Length ==nil {return "\u0075n\u0064\u0065\u0066\u0069\u006e\u0065d";};return _ga .Length .String ();}; + +// Points implements Length interface. +func (_dc Inch )Points ()Point {return Point (float64 (_dc )*_af )}; + +// UnmarshalPageSize unmarshals the page size from the string. +func UnmarshalPageSize (pageSize string )(PageSize ,error ){var _deea PageSize ;if _cca :=(&_deea ).UnmarshalText ([]byte (pageSize ));_cca !=nil {return 0,_ea .Errorf ("\u0070\u0072\u006f\u0076\u0069\u0064\u0065\u0064\u0020\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0070a\u0067\u0065\u0020\u0073\u0069\u007a\u0065\u003a\u0020\u0025\u0077",_cca ); +};return _deea ,nil ;};var _ _g .Value =(*Orientation )(nil ); // Type implements pflag.Value interface. -func (_gc Orientation )Type ()string {return "o\u0072\u0069\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e";}; +func (_fcc Orientation )Type ()string {return "o\u0072\u0069\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e";}; -// UnmarshalInch unmarshalls provided string into unit. -func UnmarshalInch (unit string )(Inch ,error ){if _bg .HasSuffix (unit ,"\u006d\u006d"){_gg ,_ce :=_cc (unit );if _ce !=nil {return 0,_ce ;};return _gg .Inches (),nil ;};if _bg .HasSuffix (unit ,"\u0069\u006e"){return _bfa (unit );};return 0,_a .Errorf ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0069\u006e\u0063\u0068\u0020\u0069\u006e\u0070\u0075\u0074\u003a\u0020%\u0073",unit ); -}; +// String implements fmt.Stringer interface. +func (_ef Orientation )String ()string {if _ef ==Portrait {return "\u0070\u006f\u0072\u0074\u0072\u0061\u0069\u0074";};return "\u006ca\u006e\u0064\u0073\u0063\u0061\u0070e";}; -// MarshalJSON implements the json.Marshaler interface for PageSize -func (_eecb PageSize )MarshalJSON ()([]byte ,error ){return _e .Marshal (_eecb .String ())}; +// PageSize is the enum used for defining the page size. +type PageSize int ; -// ValueType implements pflag.Value interface. -func (_bd Inch )ValueType ()string {return _bd .Type ()}; +// Type implements pflag.Value interface. +func (_ag *LengthFlag )Type ()string {return "\u0075\u006e\u0069\u0074"}; // Type implements pflag.Value interface. -func (_abc PageSize )Type ()string {return "\u0070a\u0067\u0065\u002d\u0073\u0069\u007ae"}; +func (_ega Point )Type ()string {return "\u0070\u006f\u0069n\u0074"}; -// Inches gets the inches equivalent from provided millimeter value. -func (_ca Millimeter )Inches ()Inch {return Inch (float64 (_ca )*_f )};func _eb (_fg Length )([]byte ,error ){if _fg ==nil {return nil ,nil ;};_gde ,_cd :=MarshalUnit (_fg );if _cd !=nil {return nil ,_cd ;};return []byte ("\u0022"+_gde +"\u0022"),nil ; -}; +// ValueType implements pflag.Value interface. +func (_dg Inch )ValueType ()string {return _dg .Type ()}; -// Length is it the default dimension unit. -type Length interface{Millimeters ()Millimeter ;Inches ()Inch ;Points ()Point ;String ()string ;}; +// MarshalJSON implements json.Marshaler interface. +func (_ggb Point )MarshalJSON ()([]byte ,error ){return _bee (_ggb )};func _bc (_fed string )(Inch ,error ){_fed =_be .TrimSpace (_be .Trim (_fed ,"\u0069\u006e"));_bcc ,_gaf :=_c .ParseFloat (_fed ,64);if _gaf !=nil {return 0,_ea .Errorf ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0069\u006e\u0063\u0068\u0020\u0076\u0061\u006c\u0075\u0065\u003a\u0020%\u0077",_gaf ); +};return Inch (_bcc ),nil ;}; -// IsAPageSize returns "true" if the value is listed in the enum definition. "false" otherwise -func (_faca PageSize )IsAPageSize ()bool {for _ ,_aaa :=range _dcb {if _faca ==_aaa {return true ;};};return false ;}; +// String implements fmt.Stringer interface. +func (_ffe Point )String ()string {_fcb :=_be .Builder {};_fcb .WriteString (_c .FormatFloat (float64 (_ffe ),'f',1,64));_fcb .WriteString ("\u0070\u0074");return _fcb .String ();}; -// Set sets the unit value. -// Implements pflag.Value interface. -func (_fc *LengthFlag )Set (s string )error {if s =="\u0075n\u0064\u0065\u0066\u0069\u006e\u0065d"{_fc .Length =nil ;return nil ;};_eaf ,_ag :=UnmarshalLength (s );if _ag !=nil {return _ag ;};_fc .Length =_eaf ;return nil ;}; +// Millimeters converts the inches value to the millimeters. +func (_ba Inch )Millimeters ()Millimeter {return Millimeter (float64 (_ba )*_ee )}; -// HasChanged implements viper.FlagValue interface. -func (_dca *Point )HasChanged ()bool {return _dca !=nil }; +// UnmarshalJSON implements the json.Unmarshaler interface for PageSize +func (_bcf *PageSize )UnmarshalJSON (data []byte )error {var _bge string ;if _ae :=_b .Unmarshal (data ,&_bge );_ae !=nil {return _ea .Errorf ("P\u0061\u0067\u0065\u0053\u0069\u007ae\u0020\u0073\u0068\u006f\u0075\u006cd\u0020\u0062\u0065\u0020\u0061\u0020\u0073t\u0072\u0069\u006e\u0067\u002c\u0020\u0067\u006f\u0074\u0020%\u0073",data ); +};var _baed error ;*_bcf ,_baed =PageSizeString (_bge );return _baed ;}; -// Millimeters gets the float64 millimeter value. -func (_gd Millimeter )Millimeters ()Millimeter {return _gd }; +// Length is it the default dimension unit. +type Length interface{Millimeters ()Millimeter ;Inches ()Inch ;Points ()Point ;String ()string ;};const (_f =float64 (1)/float64 (25.4);_ee =25.4;_a =0.0139;_gd =0.3528;_af =1.0/64;_ff =1.0/_gd ;);const _fbe ="U\u006e\u0064\u0065\u0066\u0069\u006e\u0065\u0064\u0041\u0030\u0041\u0031\u0041\u0032\u0041\u0033\u0041\u0034\u0041\u0035\u0041\u0036\u0041\u0037\u0041\u0038A\u0039A\u0031\u0030\u0042\u0030B\u0031\u00422\u0042\u0033\u0042\u0034\u0042\u0035\u0042\u0036\u0042\u0037\u0042\u0038\u0042\u0039\u0042\u0031\u0030\u004c\u0065\u0074\u0074\u0065\u0072"; -// MarshalJSON implements json.Marshaler interface -func (_fe Millimeter )MarshalJSON ()([]byte ,error ){return _eb (_fe )}; // Type implements pflag.Value interface. -func (_ef Inch )Type ()string {return "\u0069\u006e\u0063\u0068"}; +func (_bbg PageSize )Type ()string {return "\u0070a\u0067\u0065\u002d\u0073\u0069\u007ae"}; -// PageSizeValues returns all values of the enum -func PageSizeValues ()[]PageSize {return _dcb }; +// LengthFlag is a pflag wrapper for the Length value. +type LengthFlag struct{Length Length ;};var _dbf =[]PageSize {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};var _cg =map[string ]PageSize {_fbe [0:9]:0,_fbe [9:11]:1,_fbe [11:13]:2,_fbe [13:15]:3,_fbe [15:17]:4,_fbe [17:19]:5,_fbe [19:21]:6,_fbe [21:23]:7,_fbe [23:25]:8,_fbe [25:27]:9,_fbe [27:29]:10,_fbe [29:32]:11,_fbe [32:34]:12,_fbe [34:36]:13,_fbe [36:38]:14,_fbe [38:40]:15,_fbe [40:42]:16,_fbe [42:44]:17,_fbe [44:46]:18,_fbe [46:48]:19,_fbe [48:50]:20,_fbe [50:52]:21,_fbe [52:55]:22,_fbe [55:61]:23}; -// Name implements pflag.Value interface. -func (_eef Inch )Name ()string {return "\u0069\u006e\u0063\u0068"};var _ _b .Value =(*Orientation )(nil );func _cc (_fdg string )(Millimeter ,error ){_fdg =_bg .TrimSpace (_bg .TrimSuffix (_fdg ,"\u006d\u006d"));_fdd ,_dff :=_d .ParseFloat (_fdg ,64);if _dff !=nil {return 0,_a .Errorf ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u006d\u0069\u006c\u006c\u0069\u006d\u0065t\u0065r\u0020\u0076\u0061\u006c\u0075\u0065\u003a \u0025\u0077",_dff ); -};return Millimeter (_fdd ),nil ;}; + +// IsAPageSize returns "true" if the value is listed in the enum definition. "false" otherwise +func (_bg PageSize )IsAPageSize ()bool {for _ ,_ca :=range _dbf {if _bg ==_ca {return true ;};};return false ;}; + +// Set sets the unit value. +// Implements pflag.Value interface. +func (_fg *LengthFlag )Set (s string )error {if s =="\u0075n\u0064\u0065\u0066\u0069\u006e\u0065d"{_fg .Length =nil ;return nil ;};_d ,_fc :=UnmarshalLength (s );if _fc !=nil {return _fc ;};_fg .Length =_d ;return nil ;}; // Dimensions gets the dimensions of the given page size. // If provided page size is not valid than the function returns 0 values. -func (_baf PageSize )Dimensions ()(_dde ,_fac Millimeter ){switch _baf {case A0 :return 841,1189;case A1 :return 594,841;case A2 :return 420,594;case A3 :return 297,420;case A4 :return 210,297;case A5 :return 148,210;case A6 :return 105,148;case A7 :return 74,105; +func (_dbg PageSize )Dimensions ()(_gdef ,_cc Millimeter ){switch _dbg {case A0 :return 841,1189;case A1 :return 594,841;case A2 :return 420,594;case A3 :return 297,420;case A4 :return 210,297;case A5 :return 148,210;case A6 :return 105,148;case A7 :return 74,105; case A8 :return 52,74;case A9 :return 37,52;case A10 :return 26,37;case B0 :return 1000,1414;case B1 :return 707,1000;case B2 :return 500,707;case B3 :return 353,500;case B4 :return 250,353;case B5 :return 176,250;case B6 :return 125,176;case B7 :return 88,125; -case B8 :return 66,88;case B9 :return 44,62;case B10 :return 31,44;case Letter :return 215.9,279.4;};return _dde ,_fac ;}; - -// ValueString implements pflag.Value interface. -func (_bf Inch )ValueString ()string {return _bf .String ()}; +case B8 :return 66,88;case B9 :return 44,62;case B10 :return 31,44;case Letter :return 215.9,279.4;};return _gdef ,_cc ;}; -// Orientation is the page orientation type wrapper. -type Orientation bool ; - -// PageSize is the enum used for defining the page size. -type PageSize int ; - -// Point is a unit of Length commonly used to measure the height of fonts. -type Point float64 ; +// ValueType implements viper.FlagValue interface. +func (_cd Point )ValueType ()string {return _cd .Type ()}; -// LengthFlag is a pflag wrapper for the Length value. -type LengthFlag struct{Length Length ;}; +// ValueString implements viper.FlagValue interface. +func (_cb Point )ValueString ()string {return _cb .String ()}; // Points implements Length interface. -func (_ff Inch )Points ()Point {return Point (float64 (_ff )*_bb )};const (Portrait =Orientation (false );Landscape =Orientation (true );); +func (_bae Point )Points ()Point {return _bae };func (_gee PageSize )String ()string {if _gee < 0||_gee >=PageSize (len (_eba )-1){return _ea .Sprintf ("\u0050\u0061\u0067e\u0053\u0069\u007a\u0065\u0028\u0025\u0064\u0029",_gee );};return _fbe [_eba [_gee ]:_eba [_gee +1]]; +}; -// String implements fmt.Stringer interface. -func (_dd Millimeter )String ()string {_ge :=_bg .Builder {};_ge .WriteString (_d .FormatFloat (float64 (_dd ),'f',1,64));_ge .WriteString ("\u006d\u006d");return _ge .String ();}; +// UnmarshalInch unmarshalls provided string into unit. +func UnmarshalInch (unit string )(Inch ,error ){if _be .HasSuffix (unit ,"\u006d\u006d"){_gc ,_gde :=_fca (unit );if _gde !=nil {return 0,_gde ;};return _gc .Inches (),nil ;};if _be .HasSuffix (unit ,"\u0069\u006e"){return _bc (unit );};return 0,_ea .Errorf ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0069\u006e\u0063\u0068\u0020\u0069\u006e\u0070\u0075\u0074\u003a\u0020%\u0073",unit ); +};var _eba =[...]uint8 {0,9,11,13,15,17,19,21,23,25,27,29,32,34,36,38,40,42,44,46,48,50,52,55,61}; -// UnmarshalPageSize unmarshals the page size from the string. -func UnmarshalPageSize (pageSize string )(PageSize ,error ){var _gef PageSize ;if _aa :=(&_gef ).UnmarshalText ([]byte (pageSize ));_aa !=nil {return 0,_a .Errorf ("\u0070\u0072\u006f\u0076\u0069\u0064\u0065\u0064\u0020\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0070a\u0067\u0065\u0020\u0073\u0069\u007a\u0065\u003a\u0020\u0025\u0077",_aa ); -};return _gef ,nil ;}; +// Orientation is the page orientation type wrapper. +type Orientation bool ; -// String implements fmt.Stringer interface. -func (_bc Inch )String ()string {_eea :=_bg .Builder {};_eea .WriteString (_d .FormatFloat (float64 (_bc ),'f',1,64));_eea .WriteString ("\u0069\u006e");return _eea .String ();};const _bfg ="U\u006e\u0064\u0065\u0066\u0069\u006e\u0065\u0064\u0041\u0030\u0041\u0031\u0041\u0032\u0041\u0033\u0041\u0034\u0041\u0035\u0041\u0036\u0041\u0037\u0041\u0038A\u0039A\u0031\u0030\u0042\u0030B\u0031\u00422\u0042\u0033\u0042\u0034\u0042\u0035\u0042\u0036\u0042\u0037\u0042\u0038\u0042\u0039\u0042\u0031\u0030\u004c\u0065\u0074\u0074\u0065\u0072"; -const (_f =float64 (1)/float64 (25.4);_ee =25.4;_c =0.0139;_ae =0.3528;_bb =1.0/64;_ea =1.0/_ae ;); +// Type implements pflag.Value interface. +func (_bb Inch )Type ()string {return "\u0069\u006e\u0063\u0068"}; -// Points implements Length interface. -func (_eg Millimeter )Points ()Point {return Point (_eg *_ea )}; +// Name implements viper.FlagValue interface. +func (_dgg Point )Name ()string {return "\u0070\u006f\u0069n\u0074"}; -// Type implements pflag.Value interface. -func (_bbb Point )Type ()string {return "\u0070\u006f\u0069n\u0074"}; +// Set implements flag.Value interface. +func (_eeg *Point )Set (s string )error {_baf ,_fbg :=_c .ParseFloat (s ,64);if _fbg !=nil {return _ea .Errorf ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0069\u006e\u0063\u0068\u0020\u0076\u0061\u006c\u0075\u0065\u003a\u0020%\u0077",_fbg );};*_eeg =Point (_baf ); +return nil ;}; -// MarshalUnit marshals the unit into the string. -func MarshalUnit (unit Length )(string ,error ){switch _da :=unit .(type ){case Millimeter :return _a .Sprintf ("\u0025\u002e\u0030\u0066\u006d\u006d",_da ),nil ;case Inch :return _a .Sprintf ("\u0025\u002e\u0030\u0066\u0069\u006e",_da ),nil ;case Point :return _a .Sprintf ("\u0025\u002e\u0030\u0066\u0070\u0074",_da ),nil ; -default:return "",_a .Errorf ("i\u006e\u0076\u0061\u006cid\u0020u\u006e\u0069\u0074\u0020\u0074y\u0070\u0065\u003a\u0020\u0025\u0054",unit );};}; +// Set implements flag.Value interface. +func (_bf *Orientation )Set (s string )error {switch s {case "\u0070\u006f\u0072\u0074\u0072\u0061\u0069\u0074":*_bf =Portrait ;case "\u006ca\u006e\u0064\u0073\u0063\u0061\u0070e":*_bf =Landscape ;default:return _ea .Errorf ("\u0069n\u0076\u0061\u006c\u0069d\u0020\u006f\u0072\u0069\u0065n\u0074a\u0074i\u006f\u006e\u003a\u0020\u0027\u0025\u0073'",s ); +};return nil ;}; // Millimeter is the dimension unit that defines a millimeter. -type Millimeter float64 ; +type Millimeter float64 ;const (Undefined PageSize =iota ;A0 ;A1 ;A2 ;A3 ;A4 ;A5 ;A6 ;A7 ;A8 ;A9 ;A10 ;B0 ;B1 ;B2 ;B3 ;B4 ;B5 ;B6 ;B7 ;B8 ;B9 ;B10 ;Letter ;);func _fca (_deg string )(Millimeter ,error ){_deg =_be .TrimSpace (_be .TrimSuffix (_deg ,"\u006d\u006d")); +_ebf ,_fd :=_c .ParseFloat (_deg ,64);if _fd !=nil {return 0,_ea .Errorf ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u006d\u0069\u006c\u006c\u0069\u006d\u0065t\u0065r\u0020\u0076\u0061\u006c\u0075\u0065\u003a \u0025\u0077",_fd );};return Millimeter (_ebf ),nil ; +}; -// MarshalJSON implements json.Marshaler interface. -func (_ad Point )MarshalJSON ()([]byte ,error ){return _eb (_ad )}; +// Inch is a unit that +type Inch float64 ; -// Name implements viper.FlagValue interface. -func (_fa Point )Name ()string {return "\u0070\u006f\u0069n\u0074"}; +// HasChanged implements viper.FlagValue interface. +func (_aad *Point )HasChanged ()bool {return _aad !=nil }; -// Millimeters converts the inches value to the millimeters. -func (_ba Inch )Millimeters ()Millimeter {return Millimeter (float64 (_ba )*_ee )}; +// MarshalUnit marshals the unit into the string. +func MarshalUnit (unit Length )(string ,error ){switch _gfd :=unit .(type ){case Millimeter :return _ea .Sprintf ("\u0025\u002e\u0030\u0066\u006d\u006d",_gfd ),nil ;case Inch :return _ea .Sprintf ("\u0025\u002e\u0030\u0066\u0069\u006e",_gfd ),nil ;case Point :return _ea .Sprintf ("\u0025\u002e\u0030\u0066\u0070\u0074",_gfd ),nil ; +default:return "",_ea .Errorf ("i\u006e\u0076\u0061\u006cid\u0020u\u006e\u0069\u0074\u0020\u0074y\u0070\u0065\u003a\u0020\u0025\u0054",unit );};}; -// MarshalJSON implements json.Marshaler interface -func (_dc Inch )MarshalJSON ()([]byte ,error ){return _eb (_dc )};func _bfa (_ed string )(Inch ,error ){_ed =_bg .TrimSpace (_bg .Trim (_ed ,"\u0069\u006e"));_db ,_ac :=_d .ParseFloat (_ed ,64);if _ac !=nil {return 0,_a .Errorf ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0069\u006e\u0063\u0068\u0020\u0076\u0061\u006c\u0075\u0065\u003a\u0020%\u0077",_ac ); -};return Inch (_db ),nil ;};var _gcc =[...]uint8 {0,9,11,13,15,17,19,21,23,25,27,29,32,34,36,38,40,42,44,46,48,50,52,55,61}; +// String implements fmt.Stringer interface. +func (_ec Millimeter )String ()string {_gff :=_be .Builder {};_gff .WriteString (_c .FormatFloat (float64 (_ec ),'f',1,64));_gff .WriteString ("\u006d\u006d");return _gff .String ();}; -// Millimeters converts the inches value to the millimeters. -func (_aee Point )Millimeters ()Millimeter {return Millimeter (float64 (_aee )*_ae )}; +// MarshalJSON implements the json.Marshaler interface for PageSize +func (_dde PageSize )MarshalJSON ()([]byte ,error ){return _b .Marshal (_dde .String ())};var (_ Length =Millimeter (0););var _ _g .Value =(*Point )(nil ); -// ValueString implements viper.FlagValue interface. -func (_cag Point )ValueString ()string {return _cag .String ()}; +// MarshalText implements the encoding.TextMarshaler interface for PageSize +func (_fbgb PageSize )MarshalText ()([]byte ,error ){return []byte (_fbgb .String ()),nil }; -// String gets the string value for given flag. -func (_bgd *LengthFlag )String ()string {if _bgd .Length ==nil {return "\u0075n\u0064\u0065\u0066\u0069\u006e\u0065d";};return _bgd .Length .String ();}; +// Set implements pflag.Value interface. +func (_eg *Inch )Set (s string )error {_de ,_fb :=_c .ParseFloat (s ,64);if _fb !=nil {return _ea .Errorf ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0069\u006e\u0063\u0068\u0020\u0076\u0061\u006c\u0075\u0065\u003a\u0020%\u0077",_fb );};*_eg =Inch (_de ); +return nil ;}; -// MarshalText implements the encoding.TextMarshaler interface for PageSize -func (_ada PageSize )MarshalText ()([]byte ,error ){return []byte (_ada .String ()),nil }; +// Millimeters gets the float64 millimeter value. +func (_agg Millimeter )Millimeters ()Millimeter {return _agg }; -// Inches gets the inch value. Implements Length interface. -func (_fb Point )Inches ()Inch {return Inch (float64 (_fb )*_c )};const (Undefined PageSize =iota ;A0 ;A1 ;A2 ;A3 ;A4 ;A5 ;A6 ;A7 ;A8 ;A9 ;A10 ;B0 ;B1 ;B2 ;B3 ;B4 ;B5 ;B6 ;B7 ;B8 ;B9 ;B10 ;Letter ;);func (_fab PageSize )String ()string {if _fab < 0||_fab >=PageSize (len (_gcc )-1){return _a .Sprintf ("\u0050\u0061\u0067e\u0053\u0069\u007a\u0065\u0028\u0025\u0064\u0029",_fab ); -};return _bfg [_gcc [_fab ]:_gcc [_fab +1]];};var _dcb =[]PageSize {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}; +// Name implements pflag.Value interface. +func (_ge Inch )Name ()string {return "\u0069\u006e\u0063\u0068"}; -// Inches gets the inch value. Implements Length interface. -func (_ab Inch )Inches ()Inch {return _ab }; +// PageSizeString retrieves an enum value from the enum constants string name. +// Throws an error if the param is not part of the enum. +func PageSizeString (s string )(PageSize ,error ){if _dgbf ,_eff :=_cg [s ];_eff {return _dgbf ,nil ;};return 0,_ea .Errorf ("\u0025\u0073 \u0064\u006f\u0065\u0073 \u006e\u006ft\u0020\u0062\u0065\u006c\u006f\u006e\u0067\u0020t\u006f\u0020\u0050\u0061\u0067\u0065\u0053\u0069\u007a\u0065\u0020\u0076a\u006c\u0075\u0065\u0073",s ); +};var _ Length =Inch (0); -// Set implements flag.Value interface. -func (_egg *Point )Set (s string )error {_aed ,_abaa :=_d .ParseFloat (s ,64);if _abaa !=nil {return _a .Errorf ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0069\u006e\u0063\u0068\u0020\u0076\u0061\u006c\u0075\u0065\u003a\u0020%\u0077",_abaa );};*_egg =Point (_aed ); -return nil ;}; +// Inches gets the inches equivalent from provided millimeter value. +func (_bef Millimeter )Inches ()Inch {return Inch (float64 (_bef )*_f )}; -// Points implements Length interface. -func (_dfa Point )Points ()Point {return _dfa }; +// PageSizeValues returns all values of the enum +func PageSizeValues ()[]PageSize {return _dbf }; -// String implements fmt.Stringer interface. -func (_ddd Point )String ()string {_aba :=_bg .Builder {};_aba .WriteString (_d .FormatFloat (float64 (_ddd ),'f',1,64));_aba .WriteString ("\u0070\u0074");return _aba .String ();}; +// MarshalPageSize marshals the page size into string. +func MarshalPageSize (p PageSize )(string ,error ){_ad ,_egg :=p .MarshalText ();if _egg !=nil {return "",_egg ;};return string (_ad ),nil ;}; -// Set implements flag.Value interface. -func (_ga *Orientation )Set (s string )error {switch s {case "\u0070\u006f\u0072\u0074\u0072\u0061\u0069\u0074":*_ga =Portrait ;case "\u006ca\u006e\u0064\u0073\u0063\u0061\u0070e":*_ga =Landscape ;default:return _a .Errorf ("\u0069n\u0076\u0061\u006c\u0069d\u0020\u006f\u0072\u0069\u0065n\u0074a\u0074i\u006f\u006e\u003a\u0020\u0027\u0025\u0073'",s ); -};return nil ;}; +// Points implements Length interface. +func (_aga Millimeter )Points ()Point {return Point (_aga *_ff )}; -// Type implements pflag.Value interface. -func (_cg *LengthFlag )Type ()string {return "\u0075\u006e\u0069\u0074"}; +// String implements fmt.Stringer interface. +func (_aa Inch )String ()string {_gg :=_be .Builder {};_gg .WriteString (_c .FormatFloat (float64 (_aa ),'f',1,64));_gg .WriteString ("\u0069\u006e");return _gg .String ();}; -// UnmarshalJSON implements the json.Unmarshaler interface for PageSize -func (_ccf *PageSize )UnmarshalJSON (data []byte )error {var _bafa string ;if _gae :=_e .Unmarshal (data ,&_bafa );_gae !=nil {return _a .Errorf ("P\u0061\u0067\u0065\u0053\u0069\u007ae\u0020\u0073\u0068\u006f\u0075\u006cd\u0020\u0062\u0065\u0020\u0061\u0020\u0073t\u0072\u0069\u006e\u0067\u002c\u0020\u0067\u006f\u0074\u0020%\u0073",data ); -};var _dg error ;*_ccf ,_dg =PageSizeString (_bafa );return _dg ;}; +// Inches gets the inch value. Implements Length interface. +func (_eb Point )Inches ()Inch {return Inch (float64 (_eb )*_a )};func _gbe (_gffe string )(Point ,error ){_gffe =_be .TrimSpace (_be .Trim (_gffe ,"\u0070\u0074"));_agd ,_bd :=_c .ParseFloat (_gffe ,64);if _bd !=nil {return 0,_bd ;};return Point (_agd ),nil ; +};func _bee (_cde Length )([]byte ,error ){if _cde ==nil {return nil ,nil ;};_db ,_abd :=MarshalUnit (_cde );if _abd !=nil {return nil ,_abd ;};return []byte ("\u0022"+_db +"\u0022"),nil ;};const (Portrait =Orientation (false );Landscape =Orientation (true ); +); // UnmarshalText implements the encoding.TextUnmarshaler interface for PageSize -func (_aef *PageSize )UnmarshalText (text []byte )error {var _de error ;*_aef ,_de =PageSizeString (string (text ));return _de ;}; +func (_ac *PageSize )UnmarshalText (text []byte )error {var _dgd error ;*_ac ,_dgd =PageSizeString (string (text ));return _dgd ;}; -// ValueType implements viper.FlagValue interface. -func (_abf Point )ValueType ()string {return _abf .Type ()};var _eec =map[string ]PageSize {_bfg [0:9]:0,_bfg [9:11]:1,_bfg [11:13]:2,_bfg [13:15]:3,_bfg [15:17]:4,_bfg [17:19]:5,_bfg [19:21]:6,_bfg [21:23]:7,_bfg [23:25]:8,_bfg [25:27]:9,_bfg [27:29]:10,_bfg [29:32]:11,_bfg [32:34]:12,_bfg [34:36]:13,_bfg [36:38]:14,_bfg [38:40]:15,_bfg [40:42]:16,_bfg [42:44]:17,_bfg [44:46]:18,_bfg [46:48]:19,_bfg [48:50]:20,_bfg [50:52]:21,_bfg [52:55]:22,_bfg [55:61]:23}; +// Set implements pflag.Value interface. +func (_dd *PageSize )Set (s string )error {_afc ,_fcaf :=UnmarshalPageSize (s );if _fcaf !=nil {return _fcaf ;};*_dd =_afc ;return nil ;}; +// Inches gets the inch value. Implements Length interface. +func (_fbb Inch )Inches ()Inch {return _fbb }; -// PageSizeString retrieves an enum value from the enum constants string name. -// Throws an error if the param is not part of the enum. -func PageSizeString (s string )(PageSize ,error ){if _cgf ,_dffb :=_eec [s ];_dffb {return _cgf ,nil ;};return 0,_a .Errorf ("\u0025\u0073 \u0064\u006f\u0065\u0073 \u006e\u006ft\u0020\u0062\u0065\u006c\u006f\u006e\u0067\u0020t\u006f\u0020\u0050\u0061\u0067\u0065\u0053\u0069\u007a\u0065\u0020\u0076a\u006c\u0075\u0065\u0073",s ); -}; +// HasChanged implements pflag.Value interface. +func (_fcf *Inch )HasChanged ()bool {return _fcf !=nil }; -// String implements fmt.Stringer interface. -func (_egf Orientation )String ()string {if _egf ==Portrait {return "\u0070\u006f\u0072\u0074\u0072\u0061\u0069\u0074";};return "\u006ca\u006e\u0064\u0073\u0063\u0061\u0070e";}; +// ValueString implements pflag.Value interface. +func (_fe Inch )ValueString ()string {return _fe .String ()}; -// UnmarshalLength unmarshalls string value into Length. -func UnmarshalLength (length string )(Length ,error ){if _bg .HasSuffix (length ,"\u006d\u006d"){return _cc (length );};if _bg .HasSuffix (length ,"\u0069\u006e"){return _bfa (length );};if _bg .HasSuffix (length ,"\u0070\u0074"){return _cee (length ); -};return nil ,_a .Errorf ("\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u006c\u0065\u006e\u0067\u0074h\u0020\u0069\u006e\u0070\u0075\u0074\u003a\u0020\u0025\u0073",length );}; +// MarshalJSON implements json.Marshaler interface +func (_ed Inch )MarshalJSON ()([]byte ,error ){return _bee (_ed )}; -// MarshalPageSize marshals the page size into string. -func MarshalPageSize (p PageSize )(string ,error ){_cbg ,_ebf :=p .MarshalText ();if _ebf !=nil {return "",_ebf ;};return string (_cbg ),nil ;}; +// Point is a unit of Length commonly used to measure the height of fonts. +type Point float64 ; -// Inch is a unit that -type Inch float64 ; +// Millimeters converts the inches value to the millimeters. +func (_dee Point )Millimeters ()Millimeter {return Millimeter (float64 (_dee )*_gd )}; -// Set implements pflag.Value interface. -func (_fd *Inch )Set (s string )error {_cb ,_feb :=_d .ParseFloat (s ,64);if _feb !=nil {return _a .Errorf ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0069\u006e\u0063\u0068\u0020\u0076\u0061\u006c\u0075\u0065\u003a\u0020%\u0077",_feb );};*_fd =Inch (_cb ); -return nil ;}; +// UnmarshalLength unmarshalls string value into Length. +func UnmarshalLength (length string )(Length ,error ){if _be .HasSuffix (length ,"\u006d\u006d"){return _fca (length );};if _be .HasSuffix (length ,"\u0069\u006e"){return _bc (length );};if _be .HasSuffix (length ,"\u0070\u0074"){return _gbe (length ); +};return nil ,_ea .Errorf ("\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u006c\u0065\u006e\u0067\u0074h\u0020\u0069\u006e\u0070\u0075\u0074\u003a\u0020\u0025\u0073",length );}; -// HasChanged implements pflag.Value interface. -func (_fde *Inch )HasChanged ()bool {return _fde !=nil };func _cee (_ec string )(Point ,error ){_ec =_bg .TrimSpace (_bg .Trim (_ec ,"\u0070\u0074"));_adf ,_dbb :=_d .ParseFloat (_ec ,64);if _dbb !=nil {return 0,_dbb ;};return Point (_adf ),nil ;};var _ _b .Value =(*Point )(nil ); -var _ Length =Inch (0); \ No newline at end of file +// MarshalJSON implements json.Marshaler interface +func (_ab Millimeter )MarshalJSON ()([]byte ,error ){return _bee (_ab )}; \ No newline at end of file diff --git a/unihtml.go b/unihtml.go index bcfc514..1e34e4e 100644 --- a/unihtml.go +++ b/unihtml.go @@ -10,55 +10,95 @@ // terms that can be accessed at https://unidoc.io/eula/ // Package unihtml contains a plugin for the UniDoc. -package unihtml ;import (_ga "bytes";_e "context";_ea "errors";_f "fmt";_eg "github.com/unidoc/unihtml/client";_b "github.com/unidoc/unihtml/content";_ge "github.com/unidoc/unihtml/selector";_ag "github.com/unidoc/unihtml/sizes";_eab "github.com/unidoc/unipdf/v3/common"; -_c "github.com/unidoc/unipdf/v3/common/license";_bg "github.com/unidoc/unipdf/v3/creator";_egd "github.com/unidoc/unipdf/v3/model";_ce "github.com/unidoc/unipdf/v3/render";_g "image";_ab "image/color";_af "math";_a "net/url";_de "os";_fg "time";);func (_ccf *Document )validate ()error {if _cee ==nil {return ErrNoClient ; -};if _ccf ._egf ==nil {return ErrContentNotDefined ;};return nil ;}; +package unihtml ;import (_gg "bytes";_g "context";_bg "errors";_af "fmt";_cc "github.com/unidoc/unihtml/client";_bad "github.com/unidoc/unihtml/content";_ac "github.com/unidoc/unihtml/selector";_ag "github.com/unidoc/unihtml/sizes";_d "github.com/unidoc/unipdf/v3/common"; +_ee "github.com/unidoc/unipdf/v3/common/license";_gc "github.com/unidoc/unipdf/v3/creator";_ga "github.com/unidoc/unipdf/v3/model";_ad "github.com/unidoc/unipdf/v3/render";_ba "image";_e "image/color";_a "math";_f "net/url";_b "os";_ce "time";); -// ConnectOptions creates UniHTML HTTP Client and tries to establish connection with the server. -func ConnectOptions (o Options )error {_cee =_eg .New (_eg .Options {Hostname :o .Hostname ,Port :o .Port ,HTTPS :o .Secure });_cd ,_ed :=_e .WithTimeout (_e .Background (),_fg .Second *5);defer _ed ();if _afb :=_cee .HealthCheck (_cd );_afb !=nil {return _afb ; -};return nil ;};func (_gef *Document )extract (_aca _e .Context ,_dcf ,_eacf _ag .Length ,_eae margins )([]*_egd .PdfPage ,error ){_cbc :=_eg .BuildHTMLQuery ().SetContent (_gef ._egf ).PageSize (_gef ._geb ).PaperWidth (_dcf ).PaperHeight (_eacf ).Orientation (_gef ._gg ).MarginLeft (_eae .Left ).MarginRight (_eae .Right ).MarginTop (_eae .Top ).MarginBottom (_eae .Bottom ).TimeoutDuration (_gef .getTimeoutDuration ()).WaitTime (_gef ._egfb ); -for _ ,_cf :=range _gef ._ebc {_cbc .WaitReady (_cf .Selector ,_cf .By );};for _ ,_bbc :=range _gef ._dc {_cbc .WaitVisible (_bbc .Selector ,_bbc .By );};_gab ,_ee :=_cbc .Query ();if _ee !=nil {return nil ,_ee ;};var _dfaf _e .CancelFunc ;if _gef ._fae !=nil {_aca ,_dfaf =_e .WithTimeout (_aca ,*_gef ._fae ); -}else {_aca ,_dfaf =_e .WithTimeout (_aca ,_fg .Second *15);};defer _dfaf ();_ddg ,_ee :=_cee .ConvertHTML (_aca ,_gab );if _ee !=nil {return nil ,_ee ;};_egb :=_ga .NewReader (_ddg .Data );_dcb ,_ee :=_egd .NewPdfReader (_egb );if _ee !=nil {return nil ,_ee ; -};return _dcb .PageList ,nil ;}; +// WriteToFile writes the document to a file defined by the output path. +func (_ccd *Document )WriteToFile (outputPath string )error {if _ccdb :=_ccd .validate ();_ccdb !=nil {return _ccdb ;};_fge :=_ce .Second *20+_ccd ._ae ;_fb ,_abf :=_g .WithTimeout (_g .Background (),_fge );defer _abf ();_gce ,_badc :=_ccd .extract (_fb ,_ccd ._dda ,_ccd ._dcb ,_ccd .getMargins ()); +if _badc !=nil {return _badc ;};_fa :=_gc .New ();for _ ,_acd :=range _gce {if _badc =_fa .AddPage (_acd );_badc !=nil {return _badc ;};};return _fa .WriteToFile (outputPath );}; -// SetMargins sets the Document Margins. -func (_afd *Document )SetMargins (left ,right ,top ,bottom float64 ){_afd ._gc .Left =_ag .Point (left );_afd ._gc .Right =_ag .Point (right );_afd ._gc .Top =_ag .Point (top );_afd ._gc .Bottom =_ag .Point (bottom );_afd ._daf =_bg .PositionAbsolute ; -};func _aad ()error {_cb :=_c .GetLicenseKey ();if _cb ==nil {return _ea .New ("\u006e\u006f\u0020\u006cic\u0065\u006e\u0073\u0065\u0020\u0070\u0072\u006f\u0076\u0069\u0064\u0065\u0064");};if !_cb .IsLicensed (){return _ea .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u006f\u0072 \u006e\u006f\u0020\u006c\u0069\u0063\u0065n\u0073\u0065\u0020\u0070\u0072\u006f\u0076\u0069\u0064\u0065\u0064"); -};return nil ;}; +// SetMarginBottom sets the left margin. +func (_fe *Document )SetMarginBottom (margin _ag .Length ){_fe ._gaa .Bottom =margin }; // WaitVisible waits for the provided selector to be ready. // A selector might be i.e. `#example` for id and `.example` for classes. The second parameter defines how to match given selector. -func (_abfb *Document )WaitVisible (sel string ,by ..._ge .ByType ){_egff :=_ge .BySearch ;if len (by )> 0{_egff =by [0];};_abfb ._dc =append (_abfb ._dc ,_eg .BySelector {Selector :sel ,By :_egff });}; +func (_fgf *Document )WaitVisible (sel string ,by ..._ac .ByType ){_cdg :=_ac .BySearch ;if len (by )> 0{_cdg =by [0];};_fgf ._bag =append (_fgf ._bag ,_cc .BySelector {Selector :sel ,By :_cdg });}; -// WaitTime sets the waiting time before the webpage is rendered to PDF. -func (_dd *Document )WaitTime (duration _fg .Duration ){_dd ._egfb =duration }; +// TrimLastPageContent trims the last page content so that next creator blocks are located just at the end of given block. +func (_eef *Document )TrimLastPageContent (){_eef ._cd =true };type margins struct{Left ,Right ,Bottom ,Top _ag .Length ;}; + +// SetPageSize sets the page default size. +func (_add *Document )SetPageSize (pageSize _ag .PageSize )error {if !pageSize .IsAPageSize (){return _bg .New ("\u0070\u0072\u006f\u0076\u0069\u0064\u0065\u0064\u0020\u0069\u006ev\u0061\u006c\u0069\u0064\u0020\u0070\u0061\u0067\u0065\u0020s\u0069\u007a\u0065"); +};_add ._ace =pageSize ;_add ._ebf =_gc .PositionAbsolute ;return nil ;}; + +// SetMarginLeft sets the left margin. +func (_ff *Document )SetMarginLeft (margin _ag .Length ){_ff ._gaa .Left =margin }; // ContainerComponent implements creator.containerElement interface. -func (_fbd *Document )ContainerComponent (container _bg .Drawable )(_bg .Drawable ,error ){switch container .(type ){case *_bg .Chapter :default:return nil ,_f .Errorf ("\u0075\u006e\u0069\u0068t\u006d\u006c\u002e\u0044\u006f\u0063\u0075\u006d\u0065n\u0074\u0020\u0063\u0061\u006e\u0027\u0074\u0020\u0062\u0065\u0020\u0061\u0020\u0063\u006f\u006d\u0070\u006fn\u0065\u006e\u0074\u0020\u006ff\u0020\u0074\u0068\u0065\u0020\u0025\u0054\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0065\u0072",container ); -};return _fbd ,nil ;}; +func (_dag *Document )ContainerComponent (container _gc .Drawable )(_gc .Drawable ,error ){switch container .(type ){case *_gc .Chapter :default:return nil ,_af .Errorf ("\u0075\u006e\u0069\u0068t\u006d\u006c\u002e\u0044\u006f\u0063\u0075\u006d\u0065n\u0074\u0020\u0063\u0061\u006e\u0027\u0074\u0020\u0062\u0065\u0020\u0061\u0020\u0063\u006f\u006d\u0070\u006fn\u0065\u006e\u0074\u0020\u006ff\u0020\u0074\u0068\u0065\u0020\u0025\u0054\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0065\u0072",container ); +};return _dag ,nil ;}; -// SetMarginTop sets the left margin. -func (_dae *Document )SetMarginTop (margin _ag .Length ){_dae ._gc .Top =margin };func _aaa (_ac _g .Image )float64 {_eacc :=_ac .Bounds ();var (_dfa int ;_gcg _ab .Color ;_dbbc ,_adb ,_afg uint32 ;);_cea ,_aae :=_eacc .Min .X ,_eacc .Max .Y -1;_bcc :=_ac .At (_cea ,_aae ); -_aff ,_aadb ,_egee ,_ :=_bcc .RGBA ();_gcaa :=_aff ==_af .MaxUint16 &&_aadb ==_af .MaxUint16 &&_egee ==_af .MaxUint16 ;for _aae =_eacc .Max .Y -1;_aae >=_eacc .Min .Y ;_aae --{var _age bool ;for _cea =_eacc .Min .X ;_cea < _eacc .Max .X ;_cea ++{_gcg =_ac .At (_cea ,_aae ); -_dbbc ,_adb ,_afg ,_ =_gcg .RGBA ();if (_gcaa &&!(_dbbc ==_aff &&_adb ==_aadb &&_egee ==_afg ))||(!_gcaa &&(_af .Abs (float64 (_dbbc )-float64 (_aff ))/float64 (_af .MaxUint16 )> 0.03||_af .Abs (float64 (_adb )-float64 (_aadb ))/float64 (_af .MaxUint16 )> 0.03||_af .Abs (float64 (_afg )-float64 (_egee ))/float64 (_af .MaxUint16 )> 0.03)){_age =true ; -break ;};};if _age {break ;};_dfa =_aae ;};return float64 (_eacc .Max .Y -_dfa )/float64 (_eacc .Max .Y );};func (_eaeb *Document )getTimeoutDuration ()_fg .Duration {if _eaeb ._fae !=nil {return *_eaeb ._fae ;};return 0;}; +// WaitReady waits for the provided selector to be ready. +// A selector might be i.e. `#example` for id and `.example` for classes. The second parameter defines how to match given selector. +func (_ccb *Document )WaitReady (sel string ,by ..._ac .ByType ){_fd :=_ac .BySearch ;if len (by )> 0{_fd =by [0];};_ccb ._gf =append (_ccb ._gf ,_cc .BySelector {Selector :sel ,By :_fd });}; -// GeneratePageBlocks implements creator.Drawable interface. -func (_df *Document )GeneratePageBlocks (ctx _bg .DrawContext )([]*_bg .Block ,_bg .DrawContext ,error ){if _ecg :=_df .validate ();_ecg !=nil {return nil ,ctx ,_ecg ;};var _bc []*_bg .Block ;_cef :=_df .getMargins ();_eca ,_dbb :=_df ._db ,_df ._gca ; -if _df ._daf .IsRelative (){_eca ,_dbb =_ag .Point (ctx .Width ),_ag .Point (ctx .Height );ctx .X -=float64 (_cef .Left .Points ());};_gb ,_bae :=_df .extract (_e .Background (),_eca ,_dbb ,_cef );if _bae !=nil {return nil ,_bg .DrawContext {},_bae ;}; -for _geg ,_be :=range _gb {_ebe ,_bca :=_bg .NewBlockFromPage (_be );if _bca !=nil {return nil ,_bg .DrawContext {},_bca ;};var _fe float64 ;if _df ._bd &&_geg ==len (_gb )-1{_ca :=_ce .NewImageDevice ();_agc ,_bf :=_ca .Render (_be );if _bf !=nil {return nil ,_bg .DrawContext {},_bf ; -};_aed ,_bf :=_be .GetMediaBox ();if _bf !=nil {return nil ,_bg .DrawContext {},_bf ;};_abf :=_fg .Now ();_bee :=_aaa (_agc );_fe =_aed .Height ()*_bee ;_eab .Log .Trace ("\u0054\u0072i\u006d\u006d\u0069\u006eg\u0020\u006ca\u0073\u0074\u0020\u0064\u006f\u0063\u0075\u006de\u006e\u0074\u0020\u0070\u0061\u0067\u0065\u0020\u0074\u0061\u006b\u0065n\u003a\u0020\u0025\u0076",_fg .Since (_abf )); -if _df ._gc .Bottom !=nil {_fe -=float64 (_df ._gc .Bottom .Points ());};if _fe < 0{_fe =0;};_eab .Log .Trace ("C\u0072\u006f\u0070\u0070\u0069\u006e\u0067\u0020\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u0027\u0073\u0020\u0070\u0061\u0067\u0065\u0020\u0025\u002e2\u0066 \u0070\u006f\u0069\u006et\u0073\u0020o\u0066\u0066\u0020\u0062\u006f\u0074\u0074\u006f\u006d\u0020\u006f\u0066\u0020\u006d\u0065\u0064\u0069\u0061\u0020\u0062\u006f\u0078\u000a",_fe ); -};_aec ,_cc ,_bca :=_ebe .GeneratePageBlocks (ctx );if _bca !=nil {return nil ,_bg .DrawContext {},_bca ;};ctx =_cc ;ctx .Y -=_fe ;if _geg !=len (_gb )-1&&ctx .Y > (ctx .PageHeight -ctx .Margins .Bottom )*.95{ctx .X =ctx .Margins .Left ;ctx .Y =ctx .Margins .Top ; -ctx .Page ++;};_bc =append (_bc ,_aec ...);};return _bc ,ctx ,nil ;}; +// SetMarginRight sets the left margin. +func (_cccb *Document )SetMarginRight (margin _ag .Length ){_cccb ._gaa .Right =margin }; + +// SetTimeoutDuration sets the timeout duration +// the default timeout is 15 seconds. +func (_edg *Document )SetTimeoutDuration (duration _ce .Duration ){_edg ._bf =&duration };var ErrContentNotDefined =_bg .New ("\u0068\u0074\u006d\u006c\u0020\u0064o\u0063\u0075\u006d\u0065\u006e\u0074\u0020\u0063\u006f\u006e\u0074\u0065\u006et\u0020\u006e\u006f\u0074\u0020\u0064\u0065f\u0069\u006e\u0065\u0064"); +func _de (_badd _ba .Image )float64 {_ceg :=_badd .Bounds ();var (_db int ;_adc _e .Color ;_beef ,_ca ,_gab uint32 ;);_aa ,_ebb :=_ceg .Min .X ,_ceg .Max .Y -1;_fad :=_badd .At (_aa ,_ebb );_bd ,_cga ,_abfg ,_ :=_fad .RGBA ();_ddc :=_bd ==_a .MaxUint16 &&_cga ==_a .MaxUint16 &&_abfg ==_a .MaxUint16 ; +for _ebb =_ceg .Max .Y -1;_ebb >=_ceg .Min .Y ;_ebb --{var _cgae bool ;for _aa =_ceg .Min .X ;_aa < _ceg .Max .X ;_aa ++{_adc =_badd .At (_aa ,_ebb );_beef ,_ca ,_gab ,_ =_adc .RGBA ();if (_ddc &&!(_beef ==_bd &&_ca ==_cga &&_abfg ==_gab ))||(!_ddc &&(_a .Abs (float64 (_beef )-float64 (_bd ))/float64 (_a .MaxUint16 )> 0.03||_a .Abs (float64 (_ca )-float64 (_cga ))/float64 (_a .MaxUint16 )> 0.03||_a .Abs (float64 (_gab )-float64 (_abfg ))/float64 (_a .MaxUint16 )> 0.03)){_cgae =true ; +break ;};};if _cgae {break ;};_db =_ebb ;};return float64 (_ceg .Max .Y -_db )/float64 (_ceg .Max .Y );};func _fg ()error {_cg :=_ee .GetLicenseKey ();if _cg ==nil {return _bg .New ("\u006e\u006f\u0020\u006cic\u0065\u006e\u0073\u0065\u0020\u0070\u0072\u006f\u0076\u0069\u0064\u0065\u0064"); +};if !_cg .IsLicensed (){return _bg .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u006f\u0072 \u006e\u006f\u0020\u006c\u0069\u0063\u0065n\u0073\u0065\u0020\u0070\u0072\u006f\u0076\u0069\u0064\u0065\u0064");};return nil ;};func (_cfb *Document )validate ()error {if _bgd ==nil {return ErrNoClient ; +};if _cfb ._dde ==nil {return ErrContentNotDefined ;};return nil ;};func (_dcc *Document )getTimeoutDuration ()_ce .Duration {if _dcc ._bf !=nil {return *_dcc ._bf ;};return 0;}; + +// Connect creates UniHTML HTTP Client and tries to establish connection with the server. +func Connect (path string )error {if _cb :=_fg ();_cb !=nil {return _cb ;};_eb ,_dc :=_cc .ParseOptions (path );if _dc !=nil {return _dc ;};_bgd =_cc .New (_eb );_ge ,_fc :=_g .WithTimeout (_g .Background (),_ce .Second *5);defer _fc ();if _dg :=_bgd .HealthCheck (_ge ); +_dg !=nil {return _dg ;};return nil ;}; + +// SetLandscapeOrientation sets document landscape page orientation. +func (_dgc *Document )SetLandscapeOrientation (){_dgc ._bed =_ag .Landscape };var ErrNoClient =_bg .New ("\u0055n\u0069\u0048\u0054\u004d\u004c\u0020\u0063\u006c\u0069\u0065\u006et\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075\u006e\u0064"); + +// SetPageHeight sets the page height for given document. +func (_dcg *Document )SetPageHeight (pageHeight _ag .Length )error {_dcg ._dcb =pageHeight ;_dcg ._ebf =_gc .PositionAbsolute ;return nil ;};var _ _gc .Drawable =(*Document )(nil ); + +// SetMargins sets the Document Margins. +func (_ed *Document )SetMargins (left ,right ,top ,bottom float64 ){_ed ._gaa .Left =_ag .Point (left );_ed ._gaa .Right =_ag .Point (right );_ed ._gaa .Top =_ag .Point (top );_ed ._gaa .Bottom =_ag .Point (bottom );_ed ._ebf =_gc .PositionAbsolute ;}; +func (_cgg *Document )extract (_dge _g .Context ,_cde ,_dgea _ag .Length ,_cec margins )([]*_ga .PdfPage ,error ){_ebc :=_cc .BuildHTMLQuery ().SetContent (_cgg ._dde ).PageSize (_cgg ._ace ).PaperWidth (_cde ).PaperHeight (_dgea ).Orientation (_cgg ._bed ).MarginLeft (_cec .Left ).MarginRight (_cec .Right ).MarginTop (_cec .Top ).MarginBottom (_cec .Bottom ).TimeoutDuration (_cgg .getTimeoutDuration ()).WaitTime (_cgg ._ae ); +for _ ,_gee :=range _cgg ._gf {_ebc .WaitReady (_gee .Selector ,_gee .By );};for _ ,_bbb :=range _cgg ._bag {_ebc .WaitVisible (_bbb .Selector ,_bbb .By );};_fgec ,_efc :=_ebc .Query ();if _efc !=nil {return nil ,_efc ;};var _df _g .CancelFunc ;if _cgg ._bf !=nil {_dge ,_df =_g .WithTimeout (_dge ,*_cgg ._bf ); +}else {_dge ,_df =_g .WithTimeout (_dge ,_ce .Second *15);};defer _df ();_cdgg ,_efc :=_bgd .ConvertHTML (_dge ,_fgec );if _efc !=nil {return nil ,_efc ;};_gbd :=_gg .NewReader (_cdgg .Data );_abc ,_efc :=_ga .NewPdfReader (_gbd );if _efc !=nil {return nil ,_efc ; +};return _abc .PageList ,nil ;}; + +// Document is HTML document wrapper that is used for extracting and converting HTML document into PDF pages. +type Document struct{_dde _bad .Content ;_gaa margins ;_ebf _gc .Positioning ;_be ,_bee float64 ;_ace _ag .PageSize ;_dda ,_dcb _ag .Length ;_bed _ag .Orientation ;_cd bool ;_ae _ce .Duration ;_gf []_cc .BySelector ;_bag []_cc .BySelector ;_bf *_ce .Duration ; +}; + +// ConnectOptions creates UniHTML HTTP Client and tries to establish connection with the server. +func ConnectOptions (o Options )error {_bgd =_cc .New (_cc .Options {Hostname :o .Hostname ,Port :o .Port ,HTTPS :o .Secure });_da ,_ef :=_g .WithTimeout (_g .Background (),_ce .Second *5);defer _ef ();if _dd :=_bgd .HealthCheck (_da );_dd !=nil {return _dd ; +};return nil ;}; + +// NewDocumentFromString creates a new Document from the provided HTML string. +func NewDocumentFromString (html string )(*Document ,error ){_acf ,_ea :=_bad .NewStringContent (html );if _ea !=nil {return nil ,_ea ;};_bb :=&Document {};_bb ._dde =_acf ;return _bb ,nil ;}; // SetPos sets the absolute position. Changes object positioning to absolute. -func (_aeb *Document )SetPos (x ,y float64 ){_aeb ._daf =_bg .PositionAbsolute ;_aeb ._fa =x ;_aeb ._eb =y ;}; +func (_gced *Document )SetPos (x ,y float64 ){_gced ._ebf =_gc .PositionAbsolute ;_gced ._be =x ;_gced ._bee =y ;}; -// TrimLastPageContent trims the last page content so that next creator blocks are located just at the end of given block. -func (_cg *Document )TrimLastPageContent (){_cg ._bd =true };type margins struct{Left ,Right ,Bottom ,Top _ag .Length ;};func (_ede *Document )getMargins ()margins {_ef :=_ede ._gc ;if _ede ._daf .IsRelative (){_ef .Top =_ag .Millimeter (1);_ef .Left =_ag .Millimeter (1); -_ef .Bottom =_ag .Millimeter (1);_ef .Right =_ag .Millimeter (1);return _ef ;};if _ef .Top ==nil {_ef .Top =_ag .Millimeter (10);};if _ef .Bottom ==nil {_ef .Bottom =_ag .Millimeter (10);};if _ef .Left ==nil {_ef .Left =_ag .Millimeter (10);};if _ef .Right ==nil {_ef .Right =_ag .Millimeter (10); -};return _ef ;}; +// WaitTime sets the waiting time before the webpage is rendered to PDF. +func (_fadd *Document )WaitTime (duration _ce .Duration ){_fadd ._ae =duration }; + +// GeneratePageBlocks implements creator.Drawable interface. +func (_afb *Document )GeneratePageBlocks (ctx _gc .DrawContext )([]*_gc .Block ,_gc .DrawContext ,error ){if _badg :=_afb .validate ();_badg !=nil {return nil ,ctx ,_badg ;};var _gb []*_gc .Block ;_ec :=_afb .getMargins ();_fgc ,_ade :=_afb ._dda ,_afb ._dcb ; +if _afb ._ebf .IsRelative (){_fgc ,_ade =_ag .Point (ctx .Width ),_ag .Point (ctx .Height );ctx .X -=float64 (_ec .Left .Points ());}else {ctx .X =_afb ._be ;ctx .Y =_afb ._bee ;};_cdf ,_ebfe :=_afb .extract (_g .Background (),_fgc ,_ade ,_ec );if _ebfe !=nil {return nil ,_gc .DrawContext {},_ebfe ; +};for _bff ,_cbc :=range _cdf {_ggg ,_ab :=_gc .NewBlockFromPage (_cbc );if _ab !=nil {return nil ,_gc .DrawContext {},_ab ;};var _agg float64 ;if _afb ._cd &&_bff ==len (_cdf )-1{_beg :=_ad .NewImageDevice ();_fca ,_acec :=_beg .Render (_cbc );if _acec !=nil {return nil ,_gc .DrawContext {},_acec ; +};_cdd ,_acec :=_cbc .GetMediaBox ();if _acec !=nil {return nil ,_gc .DrawContext {},_acec ;};_gd :=_ce .Now ();_ccc :=_de (_fca );_agg =_cdd .Height ()*_ccc ;_d .Log .Trace ("\u0054\u0072i\u006d\u006d\u0069\u006eg\u0020\u006ca\u0073\u0074\u0020\u0064\u006f\u0063\u0075\u006de\u006e\u0074\u0020\u0070\u0061\u0067\u0065\u0020\u0074\u0061\u006b\u0065n\u003a\u0020\u0025\u0076",_ce .Since (_gd )); +if _afb ._gaa .Bottom !=nil {_agg -=float64 (_afb ._gaa .Bottom .Points ());};if _agg < 0{_agg =0;};_d .Log .Trace ("C\u0072\u006f\u0070\u0070\u0069\u006e\u0067\u0020\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u0027\u0073\u0020\u0070\u0061\u0067\u0065\u0020\u0025\u002e2\u0066 \u0070\u006f\u0069\u006et\u0073\u0020o\u0066\u0066\u0020\u0062\u006f\u0074\u0074\u006f\u006d\u0020\u006f\u0066\u0020\u006d\u0065\u0064\u0069\u0061\u0020\u0062\u006f\u0078\u000a",_agg ); +};_cfc ,_gggc ,_ab :=_ggg .GeneratePageBlocks (ctx );if _ab !=nil {return nil ,_gc .DrawContext {},_ab ;};ctx =_gggc ;ctx .Y -=_agg ;if _bff !=len (_cdf )-1&&ctx .Y > (ctx .PageHeight -ctx .Margins .Bottom )*.95{ctx .X =ctx .Margins .Left ;ctx .Y =ctx .Margins .Top ; +ctx .Page ++;};_gb =append (_gb ,_cfc ...);};return _gb ,ctx ,nil ;}; + +// GetContent returns the content of the document. +func (_afg *Document )GetContent ()_bad .Content {return _afg ._dde };var _bgd *_cc .Client ; // Options are the HTML Client options used for establishing the connection. type Options struct{ @@ -73,56 +113,19 @@ Port int ; Secure bool ; // Prefix is an option setting used when the server is working with the URI prefix. Default Value: ''. -Prefix string ;}; - -// SetTimeoutDuration sets the timeout duration -// the default timeout is 15 seconds. -func (_gcc *Document )SetTimeoutDuration (duration _fg .Duration ){_gcc ._fae =&duration };var ErrContentNotDefined =_ea .New ("\u0068\u0074\u006d\u006c\u0020\u0064o\u0063\u0075\u006d\u0065\u006e\u0074\u0020\u0063\u006f\u006e\u0074\u0065\u006et\u0020\u006e\u006f\u0074\u0020\u0064\u0065f\u0069\u006e\u0065\u0064"); - - -// WaitReady waits for the provided selector to be ready. -// A selector might be i.e. `#example` for id and `.example` for classes. The second parameter defines how to match given selector. -func (_bdd *Document )WaitReady (sel string ,by ..._ge .ByType ){_faef :=_ge .BySearch ;if len (by )> 0{_faef =by [0];};_bdd ._ebc =append (_bdd ._ebc ,_eg .BySelector {Selector :sel ,By :_faef });}; +Prefix string ;};func (_deg *Document )getMargins ()margins {_gea :=_deg ._gaa ;if _deg ._ebf .IsRelative (){_gea .Top =_ag .Millimeter (1);_gea .Left =_ag .Millimeter (1);_gea .Bottom =_ag .Millimeter (1);_gea .Right =_ag .Millimeter (1);return _gea ; +};if _gea .Top ==nil {_gea .Top =_ag .Millimeter (10);};if _gea .Bottom ==nil {_gea .Bottom =_ag .Millimeter (10);};if _gea .Left ==nil {_gea .Left =_ag .Millimeter (10);};if _gea .Right ==nil {_gea .Right =_ag .Millimeter (10);};return _gea ;}; // NewDocument creates new HTML Document used as an input for the creator.Drawable. -func NewDocument (path string )(*Document ,error ){_bb :=&Document {};_bgc ,_eabf :=_a .Parse (path );if _eabf !=nil {return nil ,_eabf ;};switch _bgc .Scheme {case "\u0068\u0074\u0074\u0070","\u0068\u0074\u0074p\u0073":_bb ._egf ,_eabf =_b .NewWebURL (path ); -if _eabf !=nil {return nil ,_eabf ;};return _bb ,nil ;};_ae ,_eabf :=_de .Stat (path );if _eabf !=nil {return nil ,_eabf ;};if !_ae .IsDir (){_bb ._egf ,_eabf =_b .NewHTMLFile (path );}else {_bb ._egf ,_eabf =_b .NewZipDirectory (path );};if _eabf !=nil {return nil ,_eabf ; -};return _bb ,nil ;}; - -// SetLandscapeOrientation sets document landscape page orientation. -func (_eaf *Document )SetLandscapeOrientation (){_eaf ._gg =_ag .Landscape }; - -// Connect creates UniHTML HTTP Client and tries to establish connection with the server. -func Connect (path string )error {if _da :=_aad ();_da !=nil {return _da ;};_ad ,_aa :=_eg .ParseOptions (path );if _aa !=nil {return _aa ;};_cee =_eg .New (_ad );_ceg ,_fc :=_e .WithTimeout (_e .Background (),_fg .Second *5);defer _fc ();if _ba :=_cee .HealthCheck (_ceg ); -_ba !=nil {return _ba ;};return nil ;}; - -// WriteToFile writes the document to a file defined by the output path. -func (_dbd *Document )WriteToFile (outputPath string )error {if _adf :=_dbd .validate ();_adf !=nil {return _adf ;};_fcf :=_fg .Second *20+_dbd ._egfb ;_ecd ,_fcfd :=_e .WithTimeout (_e .Background (),_fcf );defer _fcfd ();_fb ,_faa :=_dbd .extract (_ecd ,_dbd ._db ,_dbd ._gca ,_dbd .getMargins ()); -if _faa !=nil {return _faa ;};_ege :=_bg .New ();for _ ,_dbg :=range _fb {if _faa =_ege .AddPage (_dbg );_faa !=nil {return _faa ;};};return _ege .WriteToFile (outputPath );};var ErrNoClient =_ea .New ("\u0055n\u0069\u0048\u0054\u004d\u004c\u0020\u0063\u006c\u0069\u0065\u006et\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075\u006e\u0064"); - - -// Document is HTML document wrapper that is used for extracting and converting HTML document into PDF pages. -type Document struct{_egf _b .Content ;_gc margins ;_daf _bg .Positioning ;_fa ,_eb float64 ;_geb _ag .PageSize ;_db ,_gca _ag .Length ;_gg _ag .Orientation ;_bd bool ;_egfb _fg .Duration ;_ebc []_eg .BySelector ;_dc []_eg .BySelector ;_fae *_fg .Duration ; -}; +func NewDocument (path string )(*Document ,error ){_efe :=&Document {};_bfg ,_acb :=_f .Parse (path );if _acb !=nil {return nil ,_acb ;};switch _bfg .Scheme {case "\u0068\u0074\u0074\u0070","\u0068\u0074\u0074p\u0073":_efe ._dde ,_acb =_bad .NewWebURL (path ); +if _acb !=nil {return nil ,_acb ;};return _efe ,nil ;};_ebd ,_acb :=_b .Stat (path );if _acb !=nil {return nil ,_acb ;};if !_ebd .IsDir (){_efe ._dde ,_acb =_bad .NewHTMLFile (path );}else {_efe ._dde ,_acb =_bad .NewZipDirectory (path );};if _acb !=nil {return nil ,_acb ; +};return _efe ,nil ;}; // SetPageWidth sets the page width for given document. -func (_cbf *Document )SetPageWidth (pageWidth _ag .Length )error {_cbf ._db =pageWidth ;_cbf ._daf =_bg .PositionAbsolute ;return nil ;}; - -// SetMarginRight sets the left margin. -func (_fcb *Document )SetMarginRight (margin _ag .Length ){_fcb ._gc .Right =margin }; +func (_ege *Document )SetPageWidth (pageWidth _ag .Length )error {_ege ._dda =pageWidth ;_ege ._ebf =_gc .PositionAbsolute ;return nil ;}; -// SetPageSize sets the page default size. -func (_gcgg *Document )SetPageSize (pageSize _ag .PageSize )error {if !pageSize .IsAPageSize (){return _ea .New ("\u0070\u0072\u006f\u0076\u0069\u0064\u0065\u0064\u0020\u0069\u006ev\u0061\u006c\u0069\u0064\u0020\u0070\u0061\u0067\u0065\u0020s\u0069\u007a\u0065"); -};_gcgg ._geb =pageSize ;_gcgg ._daf =_bg .PositionAbsolute ;return nil ;}; +// SetMarginTop sets the left margin. +func (_cef *Document )SetMarginTop (margin _ag .Length ){_cef ._gaa .Top =margin }; // GetPdfPages is a function that converts provided input content and -func (_fgb *Document )GetPdfPages (ctx _e .Context )([]*_egd .PdfPage ,error ){if _eac :=_fgb .validate ();_eac !=nil {return nil ,_eac ;};return _fgb .extract (ctx ,_fgb ._db ,_fgb ._gca ,_fgb .getMargins ());}; - -// SetPageHeight sets the page height for given document. -func (_eda *Document )SetPageHeight (pageHeight _ag .Length )error {_eda ._gca =pageHeight ;_eda ._daf =_bg .PositionAbsolute ;return nil ;};var _ _bg .Drawable =(*Document )(nil );var _cee *_eg .Client ; - -// SetMarginLeft sets the left margin. -func (_gga *Document )SetMarginLeft (margin _ag .Length ){_gga ._gc .Left =margin }; - -// SetMarginBottom sets the left margin. -func (_gcb *Document )SetMarginBottom (margin _ag .Length ){_gcb ._gc .Bottom =margin }; \ No newline at end of file +func (_ddd *Document )GetPdfPages (ctx _g .Context )([]*_ga .PdfPage ,error ){if _cf :=_ddd .validate ();_cf !=nil {return nil ,_cf ;};return _ddd .extract (ctx ,_ddd ._dda ,_ddd ._dcb ,_ddd .getMargins ());}; \ No newline at end of file