Registry.require(["helper","compat","i18n"],function(){var c=Registry.get("helper"),d=Registry.get("compat"),q=Registry.get("i18n"),m=function(){this.uuid=null;this.observers=[];this.name=this.supportURL=this.updateURL=this.downloadURL=this.fileURL=this.icon64=this.icon=null;this.name_i18n={};this.description=this.homepage=this.namespace=this.version=null;this.description_i18n={};this.system=!1;this.enabled=!0;this.position=0;this.grant=[];this.requires=[];this.includes=[];this.matches=[];this.excludes=
[];this.resources=[];this.lastModified=this.lastUpdated=0;this.version=null;this.sync={imported:!1};this.options={comment:null,compatopts_for_requires:!0,compat_wrappedjsobject:!1,compat_metadata:!1,compat_foreach:!1,compat_arrayleft:!1,compat_prototypes:!1,compat_uW_gmonkey:!1,compat_forvarin:!1,noframes:null,awareOfChrome:!1,run_at:null,user_agent:"",override:{includes:!1,merge_includes:!0,use_includes:[],orig_includes:[],matches:!1,merge_matches:!0,use_matches:[],orig_matches:[],excludes:!1,merge_excludes:!0,
use_excludes:[],orig_excludes:[]}}},k={Script:m,processMetaHeader:function(a){var e={};a=a.replace(/\t/g,"    ");a=a.replace(/\r/g,"\n");a=a.replace(/\n\n+/g,"\n");a=a.replace(/[^|\n][ \t]+\/\//g,"//");var b,h,g;a=a.split("\n");for(b in a)h=a[b].replace(/^[\t\s]*\/\//gi,"").replace(/^[\t\s]*/gi,"").replace(/\s\s+/gi," "),c.each({"uso:hash":!1,version:!1},function(a,b){var c=RegExp("^@"+b+"[\\t\\s]","i"),n=a||b;-1!=h.search(c)&&(g=h.replace(c,"").replace(/[ \b\r\n]/gi,"").trim(),""!==g&&(e[n]=e[n]||
g))});return e},processHeader:function(a){var e=new m;a=a.replace(/\t/g,"    ");a=a.replace(/\r/g,"\n");a=a.replace(/\n\n+/g,"\n");a=a.replace(/[^|\n][ \t]+\/\//g,"//");var b,h,g,f;a=a.split("\n");for(h in a){g=a[h].replace(/^[\t\s]*\/\//gi,"").replace(/^[\t\s]*/gi,"").replace(/\s\s+/gi," ");f=!1;c.each({name:!1,description:!1},function(a,b){var l=a||b,p=null!==e[l],c=g.match(RegExp("^@"+b+"(\\[[a-zA-Z_\\-0-9]+\\]|:[a-zA-Z_\\-0-9]+|#[a-zA-Z_\\-0-9]+"+(p?"| [a-zA-Z_\\-0-9]+":"")+")?[\\t\\s]+(.*)$"));
if(c&&3===c.length&&(f=c[2].replace(/[\r\n]/gi,"").trim(),void 0!==f&&""!==f))if(p){var d,l=l+"_i18n";c[1]&&(d=c[1].match("[a-zA-Z_\\-0-9]+"))&&d[0]&&(c=q.parseLocale(d[0]),e[l][c]=f)}else e[l]=f});c.each({version:!1,updateURL:!1,downloadURL:!1,supportURL:!1,homepage:!1,homepageURL:"homepage",website:"homepage",source:"homepage",icon:!1,iconURL:"icon",defaulticon:"icon",icon64:!1,iconURL64:"icon64"},function(a,b){var c=RegExp("^@"+b+"[\\t\\s]","i"),d=a||b;-1!=g.search(c)&&(f=g.replace(c,"").replace(/[ \b\r\n]/gi,
"").trim(),""!==f&&(e[d]=e[d]||f))});c.each({namespace:!1,author:!1,copyright:!1},function(a,b){var c=RegExp("^@"+b+"[\\t\\s]","i"),d=a||b;-1!=g.search(c)&&(f=g.replace(c,"").replace(/[\b\r\n]/gi,"").trim(),""!==f&&(e[d]=e[d]||f))});c.each({"run-at":"run_at","user-agent":"user_agent"},function(a,b){var c=RegExp("^@"+b+"[\\t\\s]","i"),d=a||b;-1!=g.search(c)&&(f=g.replace(c,"").replace(/[\r\n]/gi,"").trim(),""!==f&&(e.options[d]=e.options[d]||f))});var d=function(a){return a.trim().replace(/ /gi,"%20").replace(/[\b\r\n]/gi,
"")};c.each({include:"includes",match:"matches",exclude:"excludes"},function(a,b){var c=RegExp("^@"+b+"[\\t\\s]","i"),h=a||b;-1!=g.search(c)&&(f=d(g.replace(c,"")).trim())&&e[h].push(f)});-1!=g.search(/^@require[\t\s]/)&&(f=d(g.replace(/^@require[\t\s]*/gi,"")).trim())&&e.requires.push({url:f,loaded:!1,textContent:""});if(-1!=g.search(/^@resource[\t\s]/)&&(f=g.replace(/^@resource[\t\s]*/gi,"").trim(),b=f.split(" "),2<=b.length)){var k=b.shift();b=d(b.join(" "));""!==k&&b&&e.resources.push({name:k,
url:b,loaded:!1})}-1!=g.search(/^@grant[\t\s]/)&&(f=g.replace(/^@grant/gi,"").replace(/[\b\r\n]/gi,"").trim())&&e.grant.push(f);c.each({noframes:!1,nocompat:"awareOfChrome"},function(a,b){var c=a||b;-1!=g.search(RegExp("^@"+b+"[\\t\\s\\r\\n]?"))&&(e.options[c]=!0)})}e.version||(e.version="0.0");return e},getHeaderTags:function(){return{start:"==UserScript==",stop:"==/UserScript=="}},getHeader:function(a){var e=c.getStringBetweenTags(a,"==UserScript==","==/UserScript==");if(!e||""==e)return null;var b=
a.search("==UserScript=="),d=a.search("<html>");a=a.search("<body>");return 0<d&&d<b||0<a&&a<b?null:e},createScriptFromSrc:function(a){a=a.replace(/(\r\n|\n|\r)/gm,"\n");var c=k.getHeader(a);if(!c)return{};var b=k.processHeader(c);b.textContent=a;b.header=c;b.options.awareOfChrome||(b.options.compat_wrappedjsobject=a!=d.unWrappedJsObjectify(a),b.options.compat_metadata=a!=d.unMetaDataify(a),b.options.compat_foreach=a!=d.unEachify(a),b.options.compat_arrayleft=a!=d.unArrayOnLeftSideify(a),b.options.compat_prototypes=
d.findPrototypes(a));-1!=a.search("unsafeWindow.gmonkey")&&(b.options.compat_uW_gmonkey=!0);return b}};Registry.register("parser","0",k)});
