commit 8d0a42dc97b9515c3c7fa010990adc25a919fc95 Author: Stein Ivar Berghei Date: Thu Jun 30 10:20:29 2022 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..964141c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +mangasee +test.js diff --git a/fakequery.js b/fakequery.js new file mode 100644 index 0000000..2dd4df0 --- /dev/null +++ b/fakequery.js @@ -0,0 +1,119 @@ +// FakeQuery... +// So you can render things on the server and not have to rewrite all +// of your code to conditionally use jQuery. +// License: MIT +// var _ = require('underscore'); + +var document = [] +var window = { + history: {}, + location: {} +} +var app = { + directive: function() { return }, + controller: function() { return } +} +var Cookies = { + get: function() { return }, + set: function() { return } +} +var moment = function() { return { unix: function() { return }}} + +// These methods return values... we'll return undefined. +var valueMethods = ["val", "attr", "width", "height"]; + +// These methods return strings... we'll return an empty string. +var stringMethods = ["html", "serialize"]; + +// Methods returning arrays... we'll return an empty array. +var arrayMethods = ["serializeArray", "toArray"]; + +// All of the functions contained on the $.fn prototype. +var chainMethods = [ + "add", "addBack", "addClass", "after", "ajaxComplete", + "ajaxError", "ajaxSend", "ajaxStart", "ajaxStop", "ajaxSuccess", + "andSelf", "animate", "append", "appendTo", "before", + "bind", "blur", "change", "children", "clearQueue", "click", + "clone", "closest", "contents", "contextmenu", + "css", "data", "dblclick", "delay", "delegate", "dequeue", + "detach", "die", "domManip", "each", "empty", "end", "eq", + "error", "extend", "fadeIn", "fadeOut", "fadeTo", "fadeToggle", + "filter", "find", "first", "focus", "focusin", "focusout", "get", + "has", "hasClass", "hide", "hover", "index", + "innerHeight", "innerWidth", "insertAfter", "insertBefore", "is", + "keydown", "keypress", "keyup", "last", "lazyload", "live", + "load", "map", "mousedown", "mouseenter", "mouseleave", + "mousemove", "mouseout", "mouseover", "mouseup", "next", + "nextAll", "nextUntil", "not", "off", "offset", "offsetParent", + "on", "one", "outerHeight", "outerWidth", "parent", "parents", + "parentsUntil", "position", "prepend", "prependTo", "prev", "prevAll", + "prevUntil", "promise", "prop", "push", "pushStack", "queue", "ready", + "remove", "removeAttr", "removeClass", "removeData", "removeProp", + "replaceAll", "replaceWith", "resize", "scroll", "scrollLeft", + "scrollTop", "select", "show", "siblings", "size", "slice", "slideDown", + "slideToggle", "slideUp", "sort", "splice", "stop", "submit", "text", + "toArray", "toggle", "toggleClass", "trigger", "triggerHandler", "unbind", "undelegate", + "unload", "unwrap", "wrap", "wrapAll", "wrapInner" +]; + +var coreMethods = [ + "Animation", "Callbacks", "Deferred", "Event", "Tween", + "_data", "_queueHooks", "abovethetop", "acceptData", "access", "ajax", + "ajaxPrefilter", "ajaxSetup", "ajaxTransport", "attr", "belowthefold", + "buildFragment", "camelCase", "clean", "cleanData", "clone", "contains", + "css", "data", "dequeue", "dir", "error", "extend", "filter", + "find", "fx", "get", "getJSON", "getScript", "globalEval", "grep", + "hasData", "holdReady", "inArray", "inviewport", "isArray", "isEmptyObject", + "isFunction", "isNumeric", "isPlainObject", "isWindow", "isXMLDoc", "leftofbegin", + "merge", "noConflict", "nodeName", "noop", "now", "param", + "parseHTML", "parseJSON", "parseXML", "post", "prop", "proxy", "queue", "ready", + "removeAttr", "removeData", "removeEvent", "rightoffold", "sibling", "speed", + "style", "sub", "swap", "text", "trim", "type", "uaMatch", "unique", "when" +]; + +var $ = function(selector, context) { + return new $.fn.init(selector, context); +}; + +$.fn = $.prototype = { + length: 0 +}; + +_.each(valueMethods, function(item) { + $.fn[item] = function() { return void 0; }; +}); + +_.each(stringMethods, function(item) { + $.fn[item] = function() { return ''; }; +}); + +_.each(arrayMethods, function(item) { + $.fn[item] = function() { return []; }; +}); + +_.each(chainMethods, function(item) { + $.fn[item] = function() { return $(this); }; +}); + +$.fn.init = function(selector, context) { + + // Handle $($); + if (selector instanceof $) return selector; + + // Handle $(function() {}); + if (typeof selector === 'function') { + return setTimeout(selector, 0); + } + + // HANDLE: $(""), $(null), $(undefined), $(false), $("anything else") + return this; +}; + +$.fn.init.prototype = $.fn; + +$.extend = function() { return _.extend.apply(_, arguments); }; +$.each = function() { return _.each.apply(_, arguments); }; +$.map = function() { return _.map.apply(_, arguments); }; +$.makeArray = function() { return _.toArray.apply(_, arguments); }; + +jQuery = $ diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..1511191 --- /dev/null +++ b/go.mod @@ -0,0 +1,14 @@ +module mangasee + +go 1.16 + +require ( + github.com/PuerkitoBio/goquery v1.6.1 // indirect + github.com/codegangsta/cli v1.20.0 // indirect + github.com/headzoo/surf v1.0.0 // indirect + github.com/mmcdole/gofeed v1.1.0 // indirect + github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac // indirect + gopkg.in/headzoo/surf.v1 v1.0.0 // indirect + gopkg.in/sourcemap.v1 v1.0.5 // indirect + rogchap.com/v8go v0.5.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..4734ed6 --- /dev/null +++ b/go.sum @@ -0,0 +1,50 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= +github.com/PuerkitoBio/goquery v1.6.1 h1:FgjbQZKl5HTmcn4sKBgvx8vv63nhyhIpv7lJpFGCWpk= +github.com/PuerkitoBio/goquery v1.6.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= +github.com/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5zzsLTo= +github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= +github.com/codegangsta/cli v1.20.0/go.mod h1:/qJNoX69yVSKu5o4jLyXAENLRyk1uhi7zkbQ3slBdOA= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/headzoo/surf v1.0.0 h1:d2h9ftKeQYj7tKqAjQtAA0lJVkO8cTxvzdXLynmNnHM= +github.com/headzoo/surf v1.0.0/go.mod h1:/bct0m/iMNEqpn520y01yoaWxsAEigGFPnvyR1ewR5M= +github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/mmcdole/gofeed v1.1.0 h1:T2WrGLVJRV04PY2qwhEJLHCt9JiCtBhb6SmC8ZvJH08= +github.com/mmcdole/gofeed v1.1.0/go.mod h1:PPiVwgDXLlz2N83KB4TrIim2lyYM5Zn7ZWH9Pi4oHUk= +github.com/mmcdole/goxpp v0.0.0-20181012175147-0068e33feabf h1:sWGE2v+hO0Nd4yFU/S/mDBM5plIU8v/Qhfz41hkDIAI= +github.com/mmcdole/goxpp v0.0.0-20181012175147-0068e33feabf/go.mod h1:pasqhqstspkosTneA62Nc+2p9SOBBYAPbnmRRWPQ0V8= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac h1:kYPjbEN6YPYWWHI6ky1J813KzIq/8+Wg4TO4xU7A/KU= +github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/urfave/cli v1.22.3/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/headzoo/surf.v1 v1.0.0 h1:Ti4LagTvHxSdHYHf5DTqJRhY4+pQYZ0slBPlxo2IWGU= +gopkg.in/headzoo/surf.v1 v1.0.0/go.mod h1:T0BH8276y+OPL0E4tisxCFjBVIAKGbwdYU7AS7/EpQQ= +gopkg.in/sourcemap.v1 v1.0.5 h1:inv58fC9f9J3TK2Y2R1NPntXEn3/wjWHkonhIUODNTI= +gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +rogchap.com/v8go v0.5.1 h1:yx7uQC2ezAHthCHLHl4NuH3eprVLBtNl6Utm/ELjZ+w= +rogchap.com/v8go v0.5.1/go.mod h1:IitZnaOtWSJadY/7qinKHIEHpxsilMWyLQ+Efdo4n4I= diff --git a/mangasee.go b/mangasee.go new file mode 100644 index 0000000..289067e --- /dev/null +++ b/mangasee.go @@ -0,0 +1,161 @@ +package main + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "strconv" + "strings" + + "github.com/PuerkitoBio/goquery" + "github.com/headzoo/surf" + "github.com/headzoo/surf/browser" + "github.com/mmcdole/gofeed/rss" + "rogchap.com/v8go" +) + +type App struct { + vm *v8go.Isolate + browser *browser.Browser + fp rss.Parser + http *http.Client + js [][]byte +} + +type MangaSeeChapter struct { + Chapter string + Type string + Page string + Date string + ChapterName string + Directory string +} + +func ChapterImage(chstr string) string { + ch := chstr[1 : len(chstr)-1] + odd := chstr[len(chstr)-1:] + if odd == "0" { + return ch + } else { + return fmt.Sprintf("%s.%s", ch, odd) + } +} + +func (app *App) GetFeed(uri string) (feed *rss.Feed, err error) { + resp, err := app.http.Get(uri) + if err != nil { + return + } + + feed, err = app.fp.Parse(resp.Body) + if err != nil { + return + } + + return +} + +func (app *App) GetChapterImages(uri string) (err error) { + vm, err := v8go.NewContext(app.vm) + if err != nil { + return + } + + err = app.browser.Open(uri) + if err != nil { + return + } + + for _, f := range app.js { + _, err = vm.RunScript(string(f), "app.js") + if err != nil { + return + } + } + + app.browser.Dom().Find("script").Each(func(_ int, s *goquery.Selection) { + if strings.Contains(s.Text(), "function MainFunction($http, $timeout){") { + _, err := vm.RunScript(s.Text(), "main.js") + if err != nil { + return + } + } + }) + + _, err = vm.RunScript("MainFunction()", "main.js") + if err != nil { + return + } + + curpathname, err := vm.RunScript("CurPathName", "main.js") + if err != nil { + return + } + + chidx, err := vm.RunScript("IndexName", "main.js") + if err != nil { + return + } + + chjson, err := vm.RunScript("JSON.stringify(CurChapter)", "main.js") + if err != nil { + return + } + + var ch MangaSeeChapter + + err = json.Unmarshal([]byte(chjson.String()), &ch) + + // src="https://{{vm.CurPathName}}/manga/To-You-The-Immortal/{{vm.CurChapter.Directory == '' ? '' : vm.CurChapter.Directory+'/'}}{{vm.ChapterImage(vm.CurChapter.Chapter)}}-{{vm.PageImage(Page)}}.png" + + //fmt.Println(ch) + + page, err := strconv.Atoi(ch.Page) + if err != nil { + return + } + + for i := 1; i <= page; i++ { + fmt.Printf("(%s) https://%s/manga/%s/%s-%.3d.png\n", ch.Chapter, curpathname.String(), chidx.String(), ChapterImage(ch.Chapter), i) + } + + return +} + +func main() { + var err error + + app := &App{} + + underscore, err := ioutil.ReadFile("./underscore-min.js") + if err != nil { + panic(err) + } + + fq, err := ioutil.ReadFile("./fakequery.js") + if err != nil { + panic(err) + } + + app.js = append(app.js, underscore) + app.js = append(app.js, fq) + + app.http = &http.Client{} + app.vm, err = v8go.NewIsolate() + if err != nil { + panic(err) + } + + app.browser = surf.NewBrowser() + app.fp = rss.Parser{} + + feed, err := app.GetFeed("https://mangasee123.com/rss/Rurouni-Kenshin-Hokkaido-Arc.xml") + if err != nil { + panic(err) + } + + for _, item := range feed.Items { + app.GetChapterImages(item.Link) + } +} diff --git a/underscore-min.js b/underscore-min.js new file mode 100644 index 0000000..c443208 --- /dev/null +++ b/underscore-min.js @@ -0,0 +1,6 @@ +!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define("underscore",r):(n=n||self,function(){var t=n._,e=n._=r();e.noConflict=function(){return n._=t,e}}())}(this,(function(){ +// Underscore.js 1.12.1 +// https://underscorejs.org +// (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors +// Underscore may be freely distributed under the MIT license. +var n="1.12.1",r="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||Function("return this")()||{},t=Array.prototype,e=Object.prototype,u="undefined"!=typeof Symbol?Symbol.prototype:null,o=t.push,i=t.slice,a=e.toString,f=e.hasOwnProperty,c="undefined"!=typeof ArrayBuffer,l="undefined"!=typeof DataView,s=Array.isArray,p=Object.keys,v=Object.create,h=c&&ArrayBuffer.isView,y=isNaN,g=isFinite,d=!{toString:null}.propertyIsEnumerable("toString"),b=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],m=Math.pow(2,53)-1;function j(n,r){return r=null==r?n.length-1:+r,function(){for(var t=Math.max(arguments.length-r,0),e=Array(t),u=0;u=0&&t<=m}}function J(n){return function(r){return null==r?void 0:r[n]}}var G=J("byteLength"),H=K(G),Q=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;var X=c?function(n){return h?h(n)&&!q(n):H(n)&&Q.test(a.call(n))}:C(!1),Y=J("length");function Z(n,r){r=function(n){for(var r={},t=n.length,e=0;e":">",'"':""","'":"'","`":"`"},Cn=Ln($n),Kn=Ln(_n($n)),Jn=tn.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},Gn=/(.)^/,Hn={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Qn=/\\|'|\r|\n|\u2028|\u2029/g;function Xn(n){return"\\"+Hn[n]}var Yn=/^\s*(\w|\$)+\s*$/;var Zn=0;function nr(n,r,t,e,u){if(!(e instanceof r))return n.apply(t,u);var o=Mn(n.prototype),i=n.apply(o,u);return _(i)?i:o}var rr=j((function(n,r){var t=rr.placeholder,e=function(){for(var u=0,o=r.length,i=Array(o),a=0;a1)ur(a,r-1,t,e),u=e.length;else for(var f=0,c=a.length;f0&&(t=r.apply(this,arguments)),n<=1&&(r=null),t}}var lr=rr(cr,2);function sr(n,r,t){r=qn(r,t);for(var e,u=nn(n),o=0,i=u.length;o0?0:u-1;o>=0&&o0?a=o>=0?o:Math.max(o+f,a):f=o>=0?Math.min(o+1,f):o+f+1;else if(t&&o&&f)return e[o=t(e,u)]===u?o:-1;if(u!=u)return(o=r(i.call(e,a,f),$))>=0?o+a:-1;for(o=n>0?a:f-1;o>=0&&o0?0:i-1;for(u||(e=r[o?o[a]:a],a+=n);a>=0&&a=3;return r(n,Fn(t,u,4),e,o)}}var Ar=wr(1),xr=wr(-1);function Sr(n,r,t){var e=[];return r=qn(r,t),jr(n,(function(n,t,u){r(n,t,u)&&e.push(n)})),e}function Or(n,r,t){r=qn(r,t);for(var e=!er(n)&&nn(n),u=(e||n).length,o=0;o=0}var Br=j((function(n,r,t){var e,u;return D(r)?u=r:(r=Nn(r),e=r.slice(0,-1),r=r[r.length-1]),_r(n,(function(n){var o=u;if(!o){if(e&&e.length&&(n=In(n,e)),null==n)return;o=n[r]}return null==o?o:o.apply(n,t)}))}));function Nr(n,r){return _r(n,Rn(r))}function Ir(n,r,t){var e,u,o=-1/0,i=-1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=er(n)?n:jn(n)).length;ao&&(o=e);else r=qn(r,t),jr(n,(function(n,t,e){((u=r(n,t,e))>i||u===-1/0&&o===-1/0)&&(o=n,i=u)}));return o}function kr(n,r,t){if(null==r||t)return er(n)||(n=jn(n)),n[Wn(n.length-1)];var e=er(n)?En(n):jn(n),u=Y(e);r=Math.max(Math.min(r,u),0);for(var o=u-1,i=0;i1&&(e=Fn(e,r[1])),r=an(n)):(e=qr,r=ur(r,!1,!1),n=Object(n));for(var u=0,o=r.length;u1&&(t=r[1])):(r=_r(ur(r,!1,!1),String),e=function(n,t){return!Er(r,t)}),Ur(n,e,t)}));function zr(n,r,t){return i.call(n,0,Math.max(0,n.length-(null==r||t?1:r)))}function Lr(n,r,t){return null==n||n.length<1?null==r||t?void 0:[]:null==r||t?n[0]:zr(n,n.length-r)}function $r(n,r,t){return i.call(n,null==r||t?1:r)}var Cr=j((function(n,r){return r=ur(r,!0,!0),Sr(n,(function(n){return!Er(r,n)}))})),Kr=j((function(n,r){return Cr(n,r)}));function Jr(n,r,t,e){A(r)||(e=t,t=r,r=!1),null!=t&&(t=qn(t,e));for(var u=[],o=[],i=0,a=Y(n);ir?(e&&(clearTimeout(e),e=null),a=c,i=n.apply(u,o),e||(u=o=null)):e||!1===t.trailing||(e=setTimeout(f,l)),i};return c.cancel=function(){clearTimeout(e),a=0,e=u=o=null},c},debounce:function(n,r,t){var e,u,o,i,a,f=function(){var c=zn()-u;r>c?e=setTimeout(f,r-c):(e=null,t||(i=n.apply(a,o)),e||(o=a=null))},c=j((function(c){return a=this,o=c,u=zn(),e||(e=setTimeout(f,r),t&&(i=n.apply(a,o))),i}));return c.cancel=function(){clearTimeout(e),e=o=a=null},c},wrap:function(n,r){return rr(r,n)},negate:fr,compose:function(){var n=arguments,r=n.length-1;return function(){for(var t=r,e=n[r].apply(this,arguments);t--;)e=n[t].call(this,e);return e}},after:function(n,r){return function(){if(--n<1)return r.apply(this,arguments)}},before:cr,once:lr,findKey:sr,findIndex:vr,findLastIndex:hr,sortedIndex:yr,indexOf:dr,lastIndexOf:br,find:mr,detect:mr,findWhere:function(n,r){return mr(n,Dn(r))},each:jr,forEach:jr,map:_r,collect:_r,reduce:Ar,foldl:Ar,inject:Ar,reduceRight:xr,foldr:xr,filter:Sr,select:Sr,reject:function(n,r,t){return Sr(n,fr(qn(r)),t)},every:Or,all:Or,some:Mr,any:Mr,contains:Er,includes:Er,include:Er,invoke:Br,pluck:Nr,where:function(n,r){return Sr(n,Dn(r))},max:Ir,min:function(n,r,t){var e,u,o=1/0,i=1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=er(n)?n:jn(n)).length;ae||void 0===t)return 1;if(t