<commit_before>const HTMLLinkElement=function(tag){const link=document.querySelector("link#"+tag+"[rel\x3dimport], link[href*\x3d"+tag+"][rel\x3dimport]")||{};Object.defineProperty(link,"onload",{enumerable:true,set(handler){this.tagName?document.addEventListener("HTMLImportsLoaded",(_)=>handler({target:this})):handler({target:this})}});return link};
class TokenList{constructor(node){const textify=(node)=>(node.text=node.textContent,node),tokenize=(token)=>token.textContent.match(/{(\w+|#)}/g).map(symbolize).map(insert(token)),symbolize=(symbol)=>symbol.match(/(\w+|#)/g)[0],insert=(token)=>(symbol)=>(this[symbol]=this[symbol]||[])&&this[symbol].push(token);this.sift(node).map(textify).map(tokenize)}sift(node){const nodes=[],visit=(node)=>node.nodeType===Node.TEXT_NODE?TEXT_NODE(node)&&NodeFilter.FILTER_ACCEPT:ELEMENT_NODE(node.attributes)&&NodeFilter.FILTER_REJECT,
TEXT_NODE=(node)=>node.nodeType===Node.TEXT_NODE&&/{(\w+|#)}/.test(node.textContent),ELEMENT_NODE=(attributes)=>Array.from(attributes||[]).filter((attr)=>/{(\w+|#)}/g.test(attr.value)).map((attribute)=>nodes.push(attribute)),walker=document.createNodeIterator(node,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,visit);while(node=walker.nextNode())nodes.push(node);return nodes}bind(context,node){const prepare=(symbol)=>this[symbol].map((token)=>token.textContent=token.text)&&symbol,replace=(symbol)=>
this[symbol].map(replacement(symbol)),replacement=(symbol)=>(item)=>item.textContent=item.textContent.replace("{"+symbol+"}",context[symbol]);Object.keys(this).map(prepare).map(replace);return this}}
const Template=function(name){return Object.assign(document.querySelector("template[name\x3d"+name+"]"),{bind});function bind(context){this.dependents=this.dependents||[];context=Array.isArray(context)?context:[context];let dependent=undefined;const records=[];while(dependent=this.dependents.pop())dependent.remove();context.forEach((item,index)=>{let clone=this.cloneNode(true),tokens=new TokenList(clone.content);item=typeof item==="object"?item:{self:item};item["#"]=index;tokens.bind(item);records.push(clone.content)});
records.map(function(record){this.dependents.push(...record.childNodes)},this);this.after(...records);return this}};const EventTarget=(Element)=>class extends Element{listen(event,listener=this[event]){this.addEventListener(event,listener)}};const ParentNode=(Element)=>class extends Element{selectAll(selector){return this.querySelectorAll(selector)}select(selector){return this.selectAll(selector)[0]}get tokens(){return this._tokens=this._tokens||new TokenList(this)}};
const GlobalEventHandlers=(Element)=>class extends Element{register(events=(event)=>/^on/.exec(event)){const nodes=":not(script):not(template):not(style):not(link)",children=Array.from(this.querySelectorAll(nodes)),registered=(node)=>Array.from(node.attributes).map((attr)=>attr.name).filter(events).length>0,handle=(event,handler=(/{\s*(\w+)\s*}/.exec(event)||[])[1])=>handler&&Element[handler].bind(this)||event||null,reflect=(self)=>(node)=>Array.from(node.attributes).map((attr)=>attr.name).filter(events).filter((name)=>
this[name]!==undefined).map(reflection(node)),reflection=(node)=>(event)=>{node[event]=handle(node[event])},mirror=(handler)=>!!!this[handler]==undefined&&(this[handler]=Element[handler].bind(this));void[this].concat(children).filter(registered).map(reflect(this));Object.getOwnPropertyNames(Element).filter(events).map(mirror);return this}};const ElementPrototype=window.Element.prototype;
const Element=function(tag,CustomElementRegistry=window.customElements){tag=tag[0];return function(HTMLElement){const context=this===window?{}:this;class HTMLCustomElement extends EventTarget(ParentNode(GlobalEventHandlers(HTMLElement))){constructor(){super();this.context=context;this.initialize&&this.initialize()}render(){this.tokens.bind(this);void function(templates){const bind=(template)=>{const name=template.getAttribute("name");void(new Template(name)).bind(this[name])};templates.map(bind)}.call(this,
Array.from(this.selectAll("template[name]")));this.register();this.constructor.onready&&this.constructor.onready.call(this)}connectedCallback(){(new HTMLLinkElement(tag)).onload=this.clone.bind(this)}clone(event){console.log("cloning")}}CustomElementRegistry.define(tag,HTMLCustomElement);return CustomElementRegistry.get(tag)}};Element.prototype=ElementPrototype;<commit_msg>Distribution bump<commit_after>const HTMLLinkElement=function(tag){console.log("before");document.addEventListener("HTMLImportsLoaded",function(){console.log({target:"foo"})});console.log("after");const link=document.querySelector("link#"+tag+"[rel\x3dimport], link[href*\x3d"+tag+"][rel\x3dimport]")||{};Object.defineProperty(link,"onload",{set(handler){console.log("link",link.tagName&&!!!HTMLImports.useNative);link.tagName&&!!!HTMLImports.useNative?document.addEventListener("HTMLImportsLoaded",(_)=>console.log("wtf")):handler({target:link})}});
return link};
class TokenList{constructor(node){const textify=(node)=>(node.text=node.textContent,node),tokenize=(token)=>token.textContent.match(/{(\w+|#)}/g).map(symbolize).map(insert(token)),symbolize=(symbol)=>symbol.match(/(\w+|#)/g)[0],insert=(token)=>(symbol)=>(this[symbol]=this[symbol]||[])&&this[symbol].push(token);this.sift(node).map(textify).map(tokenize)}sift(node){const nodes=[],visit=(node)=>node.nodeType===Node.TEXT_NODE?TEXT_NODE(node)&&NodeFilter.FILTER_ACCEPT:ELEMENT_NODE(node.attributes)&&NodeFilter.FILTER_REJECT,
TEXT_NODE=(node)=>node.nodeType===Node.TEXT_NODE&&/{(\w+|#)}/.test(node.textContent),ELEMENT_NODE=(attributes)=>Array.from(attributes||[]).filter((attr)=>/{(\w+|#)}/g.test(attr.value)).map((attribute)=>nodes.push(attribute)),walker=document.createNodeIterator(node,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,visit);while(node=walker.nextNode())nodes.push(node);return nodes}bind(context,node){const prepare=(symbol)=>this[symbol].map((token)=>token.textContent=token.text)&&symbol,replace=(symbol)=>
this[symbol].map(replacement(symbol)),replacement=(symbol)=>(item)=>item.textContent=item.textContent.replace("{"+symbol+"}",context[symbol]);Object.keys(this).map(prepare).map(replace);return this}}
const Template=function(name){return Object.assign(document.querySelector("template[name\x3d"+name+"]"),{bind});function bind(context){this.dependents=this.dependents||[];context=Array.isArray(context)?context:[context];let dependent=undefined;const records=[];while(dependent=this.dependents.pop())dependent.remove();context.forEach((item,index)=>{let clone=this.cloneNode(true),tokens=new TokenList(clone.content);item=typeof item==="object"?item:{self:item};item["#"]=index;tokens.bind(item);records.push(clone.content)});
records.map(function(record){this.dependents.push(...record.childNodes)},this);this.after(...records);return this}};const EventTarget=(Element)=>class extends Element{listen(event,listener=this[event]){this.addEventListener(event,listener)}};const ParentNode=(Element)=>class extends Element{selectAll(selector){return this.querySelectorAll(selector)}select(selector){return this.selectAll(selector)[0]}get tokens(){return this._tokens=this._tokens||new TokenList(this)}};
const GlobalEventHandlers=(Element)=>class extends Element{register(events=(event)=>/^on/.exec(event)){const nodes=":not(script):not(template):not(style):not(link)",children=Array.from(this.querySelectorAll(nodes)),registered=(node)=>Array.from(node.attributes).map((attr)=>attr.name).filter(events).length>0,handle=(event,handler=(/{\s*(\w+)\s*}/.exec(event)||[])[1])=>handler&&Element[handler].bind(this)||event||null,reflect=(self)=>(node)=>Array.from(node.attributes).map((attr)=>attr.name).filter(events).filter((name)=>
this[name]!==undefined).map(reflection(node)),reflection=(node)=>(event)=>{node[event]=handle(node[event])},mirror=(handler)=>!!!this[handler]==undefined&&(this[handler]=Element[handler].bind(this));void[this].concat(children).filter(registered).map(reflect(this));Object.getOwnPropertyNames(Element).filter(events).map(mirror);return this}};const ElementPrototype=window.Element.prototype;
const Element=function(tag,CustomElementRegistry=window.customElements){tag=tag[0];return function(HTMLElement){const context=this===window?{}:this;class HTMLCustomElement extends EventTarget(ParentNode(GlobalEventHandlers(HTMLElement))){constructor(){super();this.context=context;this.initialize&&this.initialize()}render(){this.tokens.bind(this);void function(templates){const bind=(template)=>{const name=template.getAttribute("name");void(new Template(name)).bind(this[name])};templates.map(bind)}.call(this,
Array.from(this.selectAll("template[name]")));this.register();this.constructor.onready&&this.constructor.onready.call(this)}connectedCallback(){(new HTMLLinkElement(tag)).onload=this.clone.bind(this)}clone(event){console.log("cloning",event.target);this.render()}}CustomElementRegistry.define(tag,HTMLCustomElement);return CustomElementRegistry.get(tag)}};Element.prototype=ElementPrototype;
{'fraction_non_alphanumeric': 0.2166277648104924, 'fraction_numerical': 0.0020006668889629878, 'mean_word_length': 20.023364485981308, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7340987', 'n_tokens_mistral': 2707, 'n_tokens_neox': 2707, 'n_words': 117}