Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overset flag always true if textarea content height is greater than region height #28

Open
lastmjs opened this issue Nov 15, 2015 · 7 comments

Comments

@lastmjs
Copy link

lastmjs commented Nov 15, 2015

Amazing polyfill by the way, I'm using it to print headers and footers in Chrome, which to my knowledge hasn't been possible before because of a bug in Chrome.

I am listening to the regionoversetchange event to dynamically add as many regions as my content needs. In my listener callback function, if e.target.overset is true then I create a new region (must be a fixed height) and add any remaining content to it. This repeats until there is no more remaining content, which I know if e.target.overset is false. This works fine with all of my html, except for textareas that have a content height greater than the height of the region they are being put into. In this case it seems that e.target.overset is always true, and the listener callback is called indefinitely.

I believe this is happening because the textarea elements themselves aren't actually being split up, and so when you take a textarea that won't fit into a region and then stick it into another region with the same height as the first region, nothing really changes, and e.target.overset is always true.

@lastmjs lastmjs changed the title Overset flag always true if textarea content is greater than region Overset flag always true if textarea content height is greater than region height Nov 15, 2015
@FremyCompany
Copy link
Owner

Hi,

Thank you for your kind words,

I am currently spending very few time on my public work as I'm transitioning to a new life in the United States. I'm willing to have a look at this issue at some point, though, and something that would help me immensely is a webpage which shows the issue happening. Could you provide me this?

Best regards,
Francois

@lastmjs
Copy link
Author

lastmjs commented Dec 2, 2015

So I fixed the problem for myself by swapping out my textareas for divs when I initiate using the regions, which isn't ideal but it works. Just a question before I continue with this to see if this behavior is expected. Can textareas be split up? Text within divs can be split between different regions, but the problems I was experiencing seemed to come because the textareas were always treated as one unit that could not be split between regions. If textareas could be split between regions, that would solve the problem.

@FremyCompany
Copy link
Owner

You cannot split text areas. It is the expected behavior that those are not splitted. What is unexpected is that it seems like it is carried over and over.

A real browser could split a <div contentEditable=true> element but that would not work for the polyfill because it would not update in real time. The polyfill is only meant for static content, not form controls.

I would still love to see a live webpage showcasing the problem, though.

@lastmjs
Copy link
Author

lastmjs commented Dec 3, 2015

I will get that to you as soon as plausible, thanks for the explanation

@FremyCompany
Copy link
Owner

Great, thanks 👍

@lastmjs
Copy link
Author

lastmjs commented Dec 18, 2015

Okay, forgive me for not getting to this sooner. I've attached a self-contained html file that isolates the problem for my use case. Just put in a good portion of text into the textarea, enough to be greater than 11in, or 1056 pixels. If you open up the console. you'll see that regions are added indefinitely.

css-regions-textarea-bug.html.zip

@lastmjs
Copy link
Author

lastmjs commented Dec 18, 2015

And here's the whole text if it would be useful

<html>

<body>

    <button onclick="initRegions()">Init Regions</button>

    <div id="the-textarea-container">
        <textarea id="the-textarea" rows="1" style="width: 8.5in"></textarea>
    </div>

    <style> 

        .textarea-content {
            flow-into: textarea-content contents;
        }

        .textarea-region {
            flow-from: textarea-content;
        }

    </style>

    <script id="jackmoore-autosize">
        /*! Autosize 3.0.13 license: MIT http://www.jacklmoore.com/autosize The MIT License (MIT) Copyright (c) <year> <copyright holders> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ !function(e,t){if("function"==typeof define&&define.amd)define(["exports","module"],t);else if("undefined"!=typeof exports&&"undefined"!=typeof module)t(exports,module);else{var n={exports:{}};t(n.exports,n),e.autosize=n.exports}}(this,function(e,t){"use strict";function n(e){function t(){var t=window.getComputedStyle(e,null);c=t.overflowY,"vertical"===t.resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),f="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(f)&&(f=0),i()}function n(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,c=t,u&&(e.style.overflowY=t),o()}function o(){var t=window.pageYOffset,n=document.body.scrollTop,o=e.style.height;e.style.height="auto";var i=e.scrollHeight+f;return 0===e.scrollHeight?void(e.style.height=o):(e.style.height=i+"px",v=e.clientWidth,document.documentElement.scrollTop=t,void(document.body.scrollTop=n))}function i(){var t=e.style.height;o();var i=window.getComputedStyle(e,null);if(i.height!==e.style.height?"visible"!==c&&n("visible"):"hidden"!==c&&n("hidden"),t!==e.style.height){var r=document.createEvent("Event");r.initEvent("autosize:resized",!0,!1),e.dispatchEvent(r)}}var d=void 0===arguments[1]?{}:arguments[1],s=d.setOverflowX,l=void 0===s?!0:s,a=d.setOverflowY,u=void 0===a?!0:a;if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!r.has(e)){var f=null,c=null,v=e.clientWidth,p=function(){e.clientWidth!==v&&i()},h=function(t){window.removeEventListener("resize",p),e.removeEventListener("input",i),e.removeEventListener("keyup",i),e.removeEventListener("autosize:destroy",h),r["delete"](e),Object.keys(t).forEach(function(n){e.style[n]=t[n]})}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",h),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",i),window.addEventListener("resize",p),e.addEventListener("input",i),e.addEventListener("autosize:update",i),r.add(e),l&&(e.style.overflowX="hidden",e.style.wordWrap="break-word"),t()}}function o(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName){var t=document.createEvent("Event");t.initEvent("autosize:destroy",!0,!1),e.dispatchEvent(t)}}function i(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName){var t=document.createEvent("Event");t.initEvent("autosize:update",!0,!1),e.dispatchEvent(t)}}var r="function"==typeof Set?new Set:function(){var e=[];return{has:function(t){return Boolean(e.indexOf(t)>-1)},add:function(t){e.push(t)},"delete":function(t){e.splice(e.indexOf(t),1)}}}(),d=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?(d=function(e){return e},d.destroy=function(e){return e},d.update=function(e){return e}):(d=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return n(e,t)}),e},d.destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],o),e},d.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],i),e}),t.exports=d});
    </script>

    <script id="css-regions-polyfill">
        /*! CSS-REGIONS-POLYFILL - v3.0.0 - 2015-06-20 - https://github.com/FremyCompany/css-regions-polyfill - Copyright (c) 2015 François REMY; MIT-Licensed !*/

        !function(){"use strict";var a={exports:{}},b=function(){var b={},c=function(a){return b[a]};return c.define=function(c){b[c]=a.exports,a.exports={}},c}();if(!function(a,b){a.console||(a.console={backlog:"",log:function(b){this.backlog+=b+"\n",a.debug&&alert(b)},dir:function(b){try{var c=function(a){return a.innerHTML?{tagName:a.tagName,className:a.className,id:a.id,innerHTML:a.innerHTML.substr(0,100)}:{nodeName:a.nodeName,nodeValue:a.nodeValue}},d=function(b){var d=[],e=JSON.stringify(b,function(b,e){if("object"==typeof e){if(!d.indexOf(e))return"__cycle__";if(e instanceof a.Node)return c(e);d.push(e)}return e});return e};this.log(d(b))}catch(e){this.log(b)}},warn:function(a){this.log(a)},error:function(a){this.log("ERROR:"),this.log(a)}},a.onerror||(a.onerror=function(){console.log([].slice.call(arguments,0).join("\n"))})),a.cssConsole={enabled:!!a.debug,warnEnabled:!0,log:function(a){this.enabled&&console.log(a)},dir:function(a){this.enabled&&console.dir(a)},warn:function(a){this.warnEnabled&&console.warn(a)},error:function(a){console.error(a)}}}(window,document),b.define("src/core/polyfill-dom-console.js"),a.exports=function(a,c){b("src/core/polyfill-dom-console.js");var d={cloneMouseEvent:function(a){var b=c.createEvent("MouseEvent");return b.initMouseEvent(a.type,a.canBubble||a.bubbles,a.cancelable,a.view,a.detail,a.screenX,a.screenY,a.clientX,a.clientY,a.ctrlKey,a.altKey,a.shiftKey,a.metaKey,a.button,a.relatedTarget),b},cloneKeyboardEvent:function(a){return d.cloneCustomEvent(a)},cloneCustomEvent:function(a){var b=c.createEvent("CustomEvent");b.initCustomEvent(a.type,a.canBubble||a.bubbles,a.cancelable,"detail"in a?a.detail:a);for(var d in a)try{if(a[d]!=b[d]&&a[d]!=a.target)try{b[d]=a[d]}catch(e){Object.defineProperty(b,d,{get:function(){return a[d]}})}}catch(e){}return b},cloneEvent:function(a){return a instanceof MouseEvent?d.cloneMouseEvent(a):a instanceof KeyboardEvent?d.cloneKeyboardEvent(a):d.cloneCustomEvent(a)},EventTarget:{implementsIn:function(a,b){b||"function"!=typeof a||(a=a.prototype),a.dispatchEvent=d.EventTarget.prototype.dispatchEvent,a.addEventListener=d.EventTarget.prototype.addEventListener,a.removeEventListener=d.EventTarget.prototype.removeEventListener},prototype:{}}};return d.EventTarget.prototype.addEventListener=function(a,b){this.eventListeners||(this.eventListeners=[]);var c=this.eventListeners[a]||(this.eventListeners[a]=[]);-1==c.indexOf(b)&&c.push(b)},d.EventTarget.prototype.removeEventListener=function(a,b){this.eventListeners||(this.eventListeners=[]);var c,d=this.eventListeners[a]||(this.eventListeners[a]=[]);-1!==(c=d.indexOf(b))&&d.splice(c,1)},d.EventTarget.prototype.dispatchEvent=function(a){function b(a,b,c){Object.defineProperty(b,c,{get:function(){var b=a[c];return"function"==typeof b?b.bind(a):b},set:function(b){a[c]=b}})}function d(a,c){try{Object.defineProperty(a,"target",{get:function(){return c}})}catch(e){}finally{if(a.target!==c){var f=Object.create(Object.getPrototypeOf(a));f=d(f,c);for(key in a)"target"!=key&&b(a,f,key);return f}return a}}if(this.eventListeners||(this.eventListeners=[]),"string"==typeof a){if(!this.eventListeners[a]||0==this.eventListeners[a].length)return}else if(!this.eventListeners[a.type]||0==this.eventListeners[a.type].length)return;var e=a;if("object"==typeof e)try{e=d(e,this)}catch(f){}else{if("string"!=typeof e)throw new Error("dispatchEvent expect an Event object or a string containing the event type");e=c.createEvent("CustomEvent"),e.initCustomEvent(a,!0,!1,this);try{e=d(e,this)}catch(f){}}for(var g=this.eventListeners[e.type]||(this.eventListeners[e.type]=[]),h=g.length;h--;)try{g[h](e)}catch(f){setImmediate(function(){throw f})}return e.isDefaultPrevented},d}(window,document),b.define("src/core/dom-events.js"),a.exports=function(a,b){function c(){var a=[];return a.toCSSString=d,a}function d(a){return a?this.map(function(a){return a.toCSSString()}).join(a):this.asCSSString||(this.asCSSString=this.map(function(a){return a.toCSSString()}).join("/**/").replace(/( +\/\*\*\/ *| * | *\/\*\*\/ +)/g," ").replace(/( +\/\*\*\/ *| * | *\/\*\*\/ +)/g," ").replace(/(\!|\:|\;|\@|\.|\,|\*|\=|\&|\\|\/|\<|\>|\[|\{|\(|\]|\}|\)|\|)\/\*\*\//g,"$1").replace(/\/\*\*\/(\!|\:|\;|\@|\.|\,|\*|\=|\&|\\|\/|\<|\>|\[|\{|\(|\]|\}|\)|\|)/g,"$1"))}function e(a,b,c){return a>=b&&c>=a}function f(a){return e(a,48,57)}function g(a){return f(a)||e(a,65,70)||e(a,97,102)}function h(a){return e(a,65,90)}function i(a){return e(a,97,122)}function j(a){return h(a)||i(a)}function k(a){return a>=128}function l(a){return j(a)||k(a)||95==a}function m(a){return l(a)||f(a)||45==a}function n(a){return e(a,0,8)||11==a||e(a,14,31)||127==a}function o(a){return 10==a}function p(a){return o(a)||9==a||32==a}function q(a){this.message=a}function r(a){for(var b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);if(13==d&&10==a.charCodeAt(c+1)&&(d=10,c++),(13==d||12==d)&&(d=10),0==d&&(d=65533),e(d,55296,56319)&&e(a.charCodeAt(c+1),56320,57343)){var f=d-55296,g=a.charCodeAt(c+1)-56320;d=Math.pow(2,21)+f*Math.pow(2,10)+g}b.push(d)}return b}function s(a){if(65535>=a)return String.fromCharCode(a);a-=Math.pow(2,21);var b=Math.floor(a/Math.pow(2,10))+55296,c=a%Math.pow(2,10);return String.fromCharCode(b)+String.fromCharCode(c)}function t(a){a=r(a);for(var b,d=-1,e=new c,h=0,i=0,j=0,k=function(){h+=1,j=i,i=0},q={line:h,column:i},t=function(b){return b>=a.length?-1:a[b]},u=function(a){if(void 0===a&&(a=1),a>3)throw"Spec Error: no more than three codepoints of lookahead.";return t(d+a)},D=function(a){return void 0===a&&(a=1),d+=a,b=t(d),o(b)?k():i+=a,!0},S=function(){return d-=1,o(b)?(h-=1,i=j):i-=1,q.line=h,q.column=i,!0},aa=function(a){return void 0===a&&(a=b),-1==a},ba=function(){},ca=function(){return console.log("Parse error at index "+d+", processing codepoint 0x"+b.toString(16)+"."),!0},da=function(){if(ea(),D(),p(b)){for(;p(u());)D();return new x}if(34==b)return ha();if(35==b){if(m(u())||ka(u(1),u(2))){var a=new W;return ma(u(1),u(2),u(3))&&(a.type="id"),a.value=qa(),a}return new R(b)}return 36==b?61==u()?(D(),new N):new R(b):39==b?ha():40==b?new I:41==b?new J:42==b?61==u()?(D(),new O):new R(b):43==b?pa()?(S(),fa()):new R(b):44==b?new C:45==b?pa()?(S(),fa()):45==u(1)&&62==u(2)?(D(2),new z):na()?(S(),ga()):new R(b):46==b?pa()?(S(),fa()):new R(b):58==b?new A:59==b?new B:60==b?33==u(1)&&45==u(2)&&45==u(3)?(D(3),new y):new R(b):64==b?ma(u(1),u(2),u(3))?new V(qa()):new R(b):91==b?new G:92==b?la()?(S(),ga()):(ca(),new R(b)):93==b?new H:94==b?61==u()?(D(),new M):new R(b):123==b?new E:124==b?61==u()?(D(),new L):124==u()?(D(),new P):new R(b):125==b?new F:126==b?61==u()?(D(),new K):new R(b):f(b)?(S(),fa()):l(b)?(S(),ga()):aa()?new Q:new R(b)},ea=function(){for(;47==u(1)&&42==u(2);)for(D(2);;){if(D(),42==b&&47==u()){D();break}if(aa())return void ca()}},fa=function(){var a=ra();if(ma(u(1),u(2),u(3))){var b=new _;return b.value=a.value,b.repr=a.repr,b.type=a.type,b.unit=qa(),b}if(37==u()){D();var b=new $;return b.value=a.value,b.repr=a.repr,b}var b=new Z;return b.value=a.value,b.repr=a.repr,b.type=a.type,b},ga=function(){var a=qa();if("url"==a.toLowerCase()&&40==u()){for(D();p(u(1))&&p(u(2));)D();return 34==u()||39==u()?new U(a):!p(u())||34!=u(2)&&39!=u(2)?ia():new U(a)}return 40==u()?(D(),new U(a)):new T(a)},ha=function(a){void 0===a&&(a=b);for(var c="";D();){if(b==a||aa())return new X(c);if(o(b))return ca(),S(),new v;92==b?aa(u())?ba():o(u())?D():c+=s(ja()):c+=s(b)}},ia=function(){for(var a=new Y("");p(u());)D();if(aa(u()))return a;for(;D();){if(41==b||aa())return a;if(p(b)){for(;p(u());)D();return 41==u()||aa(u())?(D(),a):(ta(),new w)}if(34==b||39==b||40==b||n(b))return ca(),ta(),new w;if(92==b){if(!la())return ca(),ta(),new w;a.value+=s(ja())}else a.value+=s(b)}},ja=function(){if(D(),g(b)){for(var a=[b],c=0;5>c&&g(u());c++)D(),a.push(b);p(u())&&D();var d=parseInt(a.map(function(a){return String.fromCharCode(a)}).join(""),16);return d>Ga&&(d=65533),d}return aa()?65533:b},ka=function(a,b){return 92!=a?!1:o(b)?!1:!0},la=function(){return ka(b,u())},ma=function(a,b,c){return 45==a?l(b)||45==b||ka(b,c):l(a)?!0:92==a?ka(a,b):!1},na=function(){return ma(b,u(1),u(2))},oa=function(a,b,c){return 43==a||45==a?f(b)?!0:46==b&&f(c)?!0:!1:46==a?f(b)?!0:!1:f(a)?!0:!1},pa=function(){return oa(b,u(1),u(2))},qa=function(){for(var a="";D();)if(m(b))a+=s(b);else{if(!la())return S(),a;a+=s(ja())}},ra=function(){var a="",c="integer";for((43==u()||45==u())&&(D(),a+=s(b));f(u());)D(),a+=s(b);if(46==u(1)&&f(u(2)))for(D(),a+=s(b),D(),a+=s(b),c="number";f(u());)D(),a+=s(b);var d=u(1),e=u(2),g=u(3);if(69!=d&&101!=d||!f(e)){if((69==d||101==d)&&(43==e||45==e)&&f(g))for(D(),a+=s(b),D(),a+=s(b),D(),a+=s(b),c="number";f(u());)D(),a+=s(b)}else for(D(),a+=s(b),D(),a+=s(b),c="number";f(u());)D(),a+=s(b);var h=sa(a);return{type:c,value:h,repr:a}},sa=function(a){return+a},ta=function(){for(;D();){if(45==b||aa())return;la()?(ja(),ba()):ba()}},ua=0;!aa(u());)if(e.push(da()),ua++>2*a.length)throw new Error("The CSS Tokenizer is infinite-looping");return e}function u(){return this}function v(){return this}function w(){return this}function x(){return this}function y(){return this}function z(){return this}function A(){return this}function B(){return this}function C(){return this}function D(){return this}function E(){return this.value="{",this.mirror="}",this}function F(){return this.value="}",this.mirror="{",this}function G(){return this.value="[",this.mirror="]",this}function H(){return this.value="]",this.mirror="[",this}function I(){return this.value="(",this.mirror=")",this}function J(){return this.value=")",this.mirror="(",this}function K(){return this}function L(){return this}function M(){return this}function N(){return this}function O(){return this}function P(){return this}function Q(){return this}function R(a){return this.value=s(a),this}function S(){return this}function T(a){this.value=a}function U(a){this.value=a,this.mirror=")"}function V(a){this.value=a}function W(a){this.value=a,this.type="unrestricted"}function X(a){this.value=a}function Y(a){this.value=a}function Z(){this.value=null,this.type="integer",this.repr=""}function $(){this.value=null,this.repr=""}function _(){this.value=null,this.type="integer",this.repr="",this.unit=""}function aa(a){a=""+a;for(var b="",c=a.charCodeAt(0),d=0;d<a.length;d++){var f=a.charCodeAt(d);if(0==f)throw new q("Invalid character: the input contains U+0000.");b+=e(f,1,31)||127==f||0==d&&e(f,48,57)||1==d&&e(f,48,57)&&45==c?"\\"+f.toString(16)+" ":f>=128||45==f||95==f||e(f,48,57)||e(f,65,90)||e(f,97,122)?a[d]:"\\"+a[d]}return b}function ba(a){a=""+a;for(var b="",c=(a.charCodeAt(0),0);c<a.length;c++){var d=a.charCodeAt(c);if(0==d)throw new q("Invalid character: the input contains U+0000.");b+=d>=128||45==d||95==d||e(d,48,57)||e(d,65,90)||e(d,97,122)?a[c]:"\\"+d.toString(16)+" "}return b}function ca(a){a=""+a;for(var b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);if(0==d)throw new q("Invalid character: the input contains U+0000.");b+=e(d,1,31)||127==d?"\\"+d.toString(16)+" ":34==d||92==d?"\\"+a[c]:a[c]}return b}function da(a){this.tokens=a,this.i=-1}function ea(a,b){return console.log("Parse error at token "+a.i+": "+a.token+".\n"+b),!0}function fa(){return!0}function ga(a,b){for(var d,e=new c;a.consume();)if(!(a.token instanceof x)){if(a.token instanceof Q)return e;if(a.token instanceof y||a.token instanceof z){if("top-level"==b)continue;a.reconsume(),(d=ia(a))&&e.push(d)}else a.token instanceof V?(a.reconsume(),(d=ha(a))&&e.push(d)):(a.reconsume(),(d=ia(a))&&e.push(d))}}function ha(a){a.consume();for(var b=new za(a.token.value);a.consume();){if(a.token instanceof B||a.token instanceof Q)return b;if(a.token instanceof E)return b.value=ma(a),b;if(a.token instanceof Ca&&"{"==a.token.name)return b.value=a.token,b;a.reconsume(),b.prelude.push(la(a))}}function ia(a){for(var b=new Aa;a.consume();){if(a.token instanceof Q)return void ea(a,"Hit EOF when trying to parse the prelude of a qualified rule.");if(a.token instanceof E)return b.value=ma(a),b;if(a.token instanceof Ca&&"{"==a.token.name)return b.value=a.token,b;a.reconsume(),b.prelude.push(la(a))}}function ja(a){for(var b=new c;a.consume();)if(a.token instanceof x||a.token instanceof B)fa();else{if(a.token instanceof Q)return b;if(a.token instanceof V)a.reconsume(),b.push(ha(a));else if(a.token instanceof T){for(var d=[a.token];!(a.next()instanceof B||a.next()instanceof Q);)d.push(la(a));var e;(e=ka(new da(d)))&&b.push(e)}else for(ea(a),a.reconsume();!(a.next()instanceof B||a.next()instanceof Q);)la(a)}}function ka(a){a.consume();for(var b=new Ba(a.token.value);a.next()instanceof x;)a.consume();if(!(a.next()instanceof A))return void ea(a);for(a.consume();!(a.next()instanceof Q);)b.value.push(la(a));for(var c=!1,d=b.value.length-1;d>=0;d--)if(!(b.value[d]instanceof x)){if(!(b.value[d]instanceof T&&b.value[d].ASCIIMatch("important"))){if(c&&b.value[d]instanceof R&&"!"==b.value[d].value){b.value.splice(d,b.value.length),b.important=!0;break}break}c=!0}return b}function la(a){return a.consume(),a.token instanceof E||a.token instanceof G||a.token instanceof I?ma(a):a.token instanceof U?na(a):a.token}function ma(a){for(var b=a.token.mirror,c=new Ca(a.token.value);a.consume();){if(a.token instanceof Q||a.token instanceof D&&a.token.value==b)return c;a.reconsume(),c.value.push(la(a))}}function na(a){for(var b=new Da(a.token.value);a.consume();){if(a.token instanceof Q||a.token instanceof J)return b;a.reconsume(),b.value.push(la(a))}}function oa(a){if("string"==typeof a)return new da(t(a));if(a instanceof da)return a;if(void 0!==a.length)return new da(a);throw SyntaxError(a)}function pa(a){a=oa(a);var b=new ya;return b.value=ga(a,"top-level"),b}function qa(a){return a=oa(a),ga(a)}function ra(a){for(a=oa(a);a.next()instanceof x;)a.consume();if(a.next()instanceof Q)throw SyntaxError();if(a.next()instanceof V)var b=ha(a);else{var b=ia(a);if(!b)throw SyntaxError()}for(;a.next()instanceof x;)a.consume();if(a.next()instanceof Q)return b;throw SyntaxError()}function sa(a){for(a=oa(a);a.next()instanceof x;)a.consume();if(!(a.next()instanceof T))throw SyntaxError();var b=ka(a);if(!b)throw new SyntaxError;return b}function ta(a){return a=oa(a),ja(a)}function ua(a){for(a=oa(a);a.next()instanceof x;)a.consume();if(a.next()instanceof Q)throw SyntaxError();var b=la(a);if(!b)throw SyntaxError();for(;a.next()instanceof x;)a.consume();if(!(a.next()instanceof Q))throw new SyntaxError;return b}function va(a){a=oa(a);for(var b=new c;;){var d=la(a);if(d instanceof Q)return b;b.push(d)}}function wa(a){a=oa(a);for(var b=new c;;)for(var d=new c;;){var e=la(a);if(e instanceof Q)return b.push(d),b;if(e instanceof C){b.push(d);break}d.push(e)}}function xa(){return this}function ya(){return this.value=new c,this}function za(a){return this.name=a,this.prelude=new c,this.value=null,this}function Aa(){return this.prelude=new c,this.selector=this.prelude,this.value=null,this}function Ba(a){return this.name=a,this.value=new c,this.important=!1,this}function Ca(a){return this.name=a,this.value=new c,this}function Da(a){return this.name=a,this.value=new c,this}function Ea(){return this.value=new c,this}var Fa={tokenize:function(a){},parse:function(a){}};Fa.TokenList=c,Fa.TokenListToCSSString=d;var Ga=1114111;return q.prototype=new Error,q.prototype.name="InvalidCharacterError",u.prototype.toJSON=function(){return{token:this.tokenType}},u.prototype.toString=function(){return this.tokenType},u.prototype.toCSSString=function(){return""+this},v.prototype=new u,v.prototype.tokenType="BADSTRING",v.prototype.toCSSString=function(){return"'"},w.prototype=new u,w.prototype.tokenType="BADURL",w.prototype.toCSSString=function(){return"url("},x.prototype=new u,x.prototype.tokenType="WHITESPACE",x.prototype.toString=function(){return"WS"},x.prototype.toCSSString=function(){return" "},y.prototype=new u,y.prototype.tokenType="CDO",y.prototype.toCSSString=function(){return"<!--"},z.prototype=new u,z.prototype.tokenType="CDC",z.prototype.toCSSString=function(){return"-->"},A.prototype=new u,A.prototype.tokenType=":",B.prototype=new u,B.prototype.tokenType=";",C.prototype=new u,C.prototype.tokenType=",",C.prototype.value=";",D.prototype=new u,E.prototype=new D,E.prototype.tokenType="{",F.prototype=new D,F.prototype.tokenType="}",G.prototype=new D,G.prototype.tokenType="[",H.prototype=new D,H.prototype.tokenType="]",I.prototype=new D,I.prototype.tokenType="(",J.prototype=new D,J.prototype.tokenType=")",K.prototype=new u,K.prototype.tokenType="~=",L.prototype=new u,L.prototype.tokenType="|=",M.prototype=new u,M.prototype.tokenType="^=",N.prototype=new u,N.prototype.tokenType="$=",O.prototype=new u,O.prototype.tokenType="*=",P.prototype=new u,P.prototype.tokenType="||",Q.prototype=new u,Q.prototype.tokenType="EOF",Q.prototype.toCSSString=function(){return""},R.prototype=new u,R.prototype.tokenType="DELIM",R.prototype.toString=function(){return"DELIM("+this.value+")"},R.prototype.toCSSString=function(){return"\\"==this.value?"\\\n":this.value},S.prototype=new u,S.prototype.ASCIIMatch=function(a){return this.value.toLowerCase()==a.toLowerCase()},T.prototype=new S,T.prototype.tokenType="IDENT",T.prototype.toString=function(){return"IDENT("+this.value+")"},T.prototype.toCSSString=function(){return aa(this.value)},U.prototype=new S,U.prototype.tokenType="FUNCTION",U.prototype.toString=function(){return"FUNCTION("+this.value+")"},U.prototype.toCSSString=function(){return aa(this.value)+"("},V.prototype=new S,V.prototype.tokenType="AT-KEYWORD",V.prototype.toString=function(){return"AT("+this.value+")"},V.prototype.toCSSString=function(){return"@"+aa(this.value)},W.prototype=new S,W.prototype.tokenType="HASH",W.prototype.toString=function(){return"HASH("+this.value+")"},W.prototype.toCSSString=function(){var a="id"==this.type?aa:ba;return"#"+a(this.value)},X.prototype=new S,X.prototype.tokenType="STRING",X.prototype.toString=function(){return'"'+ca(this.value)+'"'},Y.prototype=new S,Y.prototype.tokenType="URL",Y.prototype.toString=function(){return"URL("+this.value+")"},Y.prototype.toCSSString=function(){return'url("'+ca(this.value)+'")'},Z.prototype=new u,Z.prototype.tokenType="NUMBER",Z.prototype.toString=function(){return"integer"==this.type?"INT("+this.value+")":"NUMBER("+this.value+")"},Z.prototype.toJSON=function(){var a=this.constructor.prototype.constructor.prototype.toJSON.call(this);return a.value=this.value,a.type=this.type,a.repr=this.repr,a},Z.prototype.toCSSString=function(){return this.repr},$.prototype=new u,$.prototype.tokenType="PERCENTAGE",$.prototype.toString=function(){return"PERCENTAGE("+this.value+")"},$.prototype.toCSSString=function(){return this.repr+"%"},_.prototype=new u,_.prototype.tokenType="DIMENSION",_.prototype.toString=function(){return"DIM("+this.value+","+this.unit+")"},_.prototype.toCSSString=function(){var a=this.repr,b=aa(this.unit);return"e"!=b[0].toLowerCase()||"-"!=b[1]&&!e(b.charCodeAt(1),48,57)||(b="\\65 "+b.slice(1,b.length)),a+b},Fa.tokenize=t,Fa.IdentToken=T,Fa.IdentifierToken=T,Fa.FunctionToken=U,Fa.AtKeywordToken=V,Fa.HashToken=W,Fa.StringToken=X,Fa.BadStringToken=v,Fa.URLToken=Y,Fa.BadURLToken=w,Fa.DelimToken=R,Fa.NumberToken=Z,Fa.PercentageToken=$,Fa.DimensionToken=_,Fa.IncludeMatchToken=K,Fa.DashMatchToken=L,Fa.PrefixMatchToken=M,Fa.SuffixMatchToken=N,Fa.SubstringMatchToken=O,Fa.ColumnToken=P,Fa.WhitespaceToken=x,Fa.CDOToken=y,Fa.CDCToken=z,Fa.ColonToken=A,Fa.SemicolonToken=B,Fa.CommaToken=C,Fa.OpenParenToken=I,Fa.CloseParenToken=J,Fa.OpenSquareToken=G,Fa.CloseSquareToken=H,Fa.OpenCurlyToken=E,Fa.CloseCurlyToken=F,Fa.EOFToken=Q,Fa.CSSParserToken=u,Fa.GroupingToken=D,da.prototype.tokenAt=function(a){return a<this.tokens.length?this.tokens[a]:new Q},da.prototype.consume=function(a){return void 0===a&&(a=1),this.i+=a,this.token=this.tokenAt(this.i),!0},da.prototype.next=function(){return this.tokenAt(this.i+1)},da.prototype.reconsume=function(){this.i--},xa.prototype.toString=function(a){return JSON.stringify(this,null,a)},ya.prototype=new xa,ya.prototype.type="STYLESHEET",ya.prototype.toCSSString=function(){return this.value.toCSSString("\n")},za.prototype=new xa,za.prototype.toCSSString=function(){return this.value?"@"+aa(this.name)+" "+this.prelude.toCSSString()+this.value.toCSSString():"@"+aa(this.name)+" "+this.prelude.toCSSString()+"; "},za.prototype.toStylesheet=function(){return this.asStylesheet||(this.asStylesheet=this.value?pa(this.value.value):new ya)},Aa.prototype=new xa,Aa.prototype.type="STYLE-RULE",Aa.prototype.toCSSString=function(){return this.prelude.toCSSString()+this.value.toCSSString()},Aa.prototype.getSelector=function(){return this.prelude},Aa.prototype.getDeclarations=function(){if(!(this.value instanceof Ca))return new c;var a=this.value.value;return ta(a)},Ba.prototype=new xa,Ba.prototype.type="DECLARATION",Ba.prototype.toCSSString=function(){return this.name+":"+this.value.toCSSString()+"; "},Ca.prototype=new xa,Ca.prototype.type="BLOCK",Ca.prototype.toCSSString=function(){switch(this.name){case"(":return"("+this.value.toCSSString()+")";case"[":return"["+this.value.toCSSString()+"]";case"{":return"{"+this.value.toCSSString()+"}";default:return this.name+this.value.toCSSString()+this.name}},Da.prototype=new xa,Da.prototype.type="FUNCTION",Da.prototype.toCSSString=function(){return this.name+"("+this.value.toCSSString()+")"},Da.prototype.getArguments=function(){for(var a=new c,b=new c,d=this.value,e=0;e<d.length;e++)","==d[e].tokenType?(a.push(b),b=new c):b.push(d[e]);return(a.length>0||b.length>0)&&a.push(b),a},Ea.prototype=new xa,Ea.prototype.type="FUNCTION-ARG",Ea.prototype.toCSSString=function(){return this.value.toCSSString()+", "},Fa.CSSParserRule=xa,Fa.Stylesheet=ya,Fa.AtRule=za,Fa.StyleRule=Aa,Fa.Declaration=Ba,Fa.SimpleBlock=Ca,Fa.Func=Da,Fa.parseAStylesheet=pa,Fa.parseAListOfRules=qa,Fa.parseARule=ra,Fa.parseADeclaration=sa,Fa.parseAListOfDeclarations=ta,Fa.parseAComponentValue=ua,Fa.parseAListOfComponentValues=va,Fa.parseACommaSeparatedListOfComponentValues=wa,Fa.parse=pa,Fa.parseCSSValue=va,Fa}(),b.define("src/core/css-syntax.js"),void function(){for(var a=["webkit","moz","ms","o"],b=0;b<a.length&&!window.requestAnimationFrame;++b){var c=a[b];window.requestAnimationFrame=window[c+"RequestAnimationFrame"],window.cancelAnimationFrame=window[c+"CancelAnimationFrame"]||window[c+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame||!window.cancelAnimationFrame){var d=0,e=[],f=[],g=function(){var a=+new Date,b=e;e=f;for(var c=0;c<b.length;c++)b[c](a);d+=b.length,b.length=0,f=b,setTimeout(g,16)};g(),window.requestAnimationFrame=function(a){return d+e.push(a)},window.cancelAnimationFrame=function(a){a-=d,a>=0&&a<e.length&&(e[a]=function(){})}}window.setImmediate||(window.setImmediate=function(a){return setTimeout(a,0)},window.cancelImmediate=clearTimeout)}(),b.define("src/core/polyfill-dom-requestAnimationFrame.js"),a.exports=function(a,b){function c(a,b,c){var d=this;b||(b=function(){}),c||(c=a);var e=!1,f=!1,g=!1,h=null,i=function(){g=!0;try{h&&h(d)}catch(a){setImmediate(function(){throw a})}g&&j()},j=(this.schedule=function(b){if(f)throw new Error("Cannot schedule on a disconnected event stream");if(e&&!g)throw new Error("Cannot schedule on an already-scheduled event stream");h=b,g=!1,e?c(i):(a(i),e=!0)},this.dispose=function(){e&&(b(),d=null,i=null,h=null,e=!1,f=!0,g=!1)})}function d(a){var b=0;c.call(this,function(a){b=requestAnimationFrame(a)},function(){cancelAnimationFrame(b)})}function e(a){var b=0,d="number"==typeof a?+a:"timeout"in a?+a.timeout:333;c.call(this,function(a){b=setTimeout(a,d)},function(){clearTimeout(b)})}function f(){var b="PointerEvent"in a?"pointermove":"MSPointerEvent"in a?"MSPointerMove":"mousemove",d=!1,e=null,f=function(){d||(a.removeEventListener(b,f,!0),d=requestAnimationFrame(e))};c.call(this,function(c){e=c,a.addEventListener(b,f,!0)},function(){a.removeEventListener(b,f,!0),cancelAnimationFrame(d),f=null,e=null,d=!1},function(c){e=c,d=!1,a.addEventListener(b,f,!0)})}function g(){var b="PointerEvent"in a?"pointerup":"MSPointerEvent"in a?"MSPointerUp":"mouseup",d="PointerEvent"in a?"pointerdown":"MSPointerEvent"in a?"MSPointerDown":"mousedown",e=!1,f=null,g=function(){e||(a.removeEventListener(b,g,!0),a.removeEventListener(d,g,!0),e=requestAnimationFrame(f))};c.call(this,function(c){f=c,a.addEventListener(b,g,!0),a.addEventListener(d,g,!0)},function(){a.removeEventListener(b,g,!0),a.removeEventListener(d,g,!0),cancelAnimationFrame(e),g=null,f=null,e=!1},function(c){f=c,e=!1,a.addEventListener(b,g,!0),a.addEventListener(d,g,!0)})}function h(){var a=null,d=null,e=!1,f=0,g=function(){d==b.activeElement&&e==b.hasFocus()?setTimeout(g,333):(d=b.activeElement,e=b.hasFocus(),a())};c.call(this,function(b){a=b,f=setTimeout(g,500)},function(){clearTimeout(f),g=null,a=null,f=0},function(b){a=b,f=setTimeout(g,100)})}function i(a,b){var d=this,e=null,f=!1,g=!1,h=function(c){c==a&&(f=!0),c==b&&(g=!0),f&&g||e(d)};c.call(this,function(c){e=c,a.schedule(h),b.schedule(h)},function(){a.dispose(),b.dispose()},function(c){e=c,f&&a.schedule(h),g&&b.schedule(h),f=g=!1})}var j;return j="MutationObserver"in a?function(a){if(a)var d="target"in a?a.target:b.documentElement,e={subtree:"subtree"in a?!!a.subtree:!0,attributes:"attributes"in a?!!a.attributes:!0,childList:"childList"in a?!!a.childList:!0,characterData:"characterData"in a?!!a.characterData:!1};else var d=b.documentElement,e={subtree:!0,attributes:!0,childList:!0,characterData:!1};var f=null;c.call(this,function(a){e&&(f=new MutationObserver(a),f.observe(d,e),d=null,e=null)},function(){f&&f.disconnect(),f=null},function(){f.takeRecords()})}:"MutationEvent"in a?function(a){var d=!1;if(a)var e="target"in a?a.target:b.documentElement;else var e=b.documentElement;var f=null,g=function(){!d&&g&&(b.removeEventListener("DOMContentLoaded",g,!1),b.removeEventListener("DOMContentLoaded",g,!1),e.removeEventListener("DOMSubtreeModified",g,!1),d=requestAnimationFrame(f))};c.call(this,function(a){f=a,b.addEventListener("DOMContentLoaded",g,!1),e.addEventListener("DOMSubtreeModified",g,!1)},function(){b.removeEventListener("DOMContentLoaded",g,!1),e.removeEventListener("DOMSubtreeModified",g,!1),cancelAnimationFrame(d),g=null,f=null,d=!1},function(a){f=a,d=!1,e.addEventListener("DOMSubtreeModified",g,!1)})}:d,{EventStream:c,AnimationFrameEventStream:d,TimeoutEventStream:e,MouseEventStream:f,MouseButtonEventStream:g,DOMUpdateEventStream:j,FocusEventStream:h,CompositeEventStream:i}}(window,document),b.define("src/core/dom-experimental-event-streams.js"),a.exports=function(a,c){function d(a,b,d){var e,d=d||c,m=[],n=function q(e){e.schedule(q);for(var f=[],g=m.slice(0),h=d.querySelectorAll(a),i=f.length=h.length;i;)f.push(h[--i]);m=f.slice(0),h=null,g=g.filter(function(a){var d=a===c.documentElement||c.documentElement.contains(a);if(d)return!0;try{b.onremoved&&b.onremoved(a)}catch(e){setImmediate(function(){throw e})}return!1});for(var j=g.pop(),k=f.pop();j||k;)if(j===k)j=g.pop(),k=f.pop();else if(!k||j&&0!==(43&k.compareDocumentPosition(j))){try{b.onremoved&&b.onremoved(j)}catch(l){setImmediate(function(){throw l})}j=g.pop()}else{try{b.onadded&&b.onadded(k)}catch(l){setImmediate(function(){throw l})}k=f.pop()}},o=a.replace(/:(dir|lang|root|empty|blank|nth-child|nth-last-child|first-child|last-child|only-child|nth-of-type|nth-last-of-child|fist-of-type|last-of-type|only-of-type|not|matches|default)\b/gi,"");if(-1==o.indexOf(":"))e=new f({target:d});else if(e=new f({target:d}),f!=g){var p=/:(focus|active)\b/gi;if(p.test(o)){e=new h(new i,e);var p=/:(focus)\b/gi;o=o.replace(p,"")}var p=/:(active)\b/gi;p.test(o)&&(e=new h(new j,e),o=o.replace(p,""));var p=/:(target|checked|indeterminate|valid|invalid|in-range|out-of-range|user-error)\b/gi;if(p.test(o)){e=new h(new k(250),e),o=o.replace(p,"");var p=/:(any-link|link|visited|local-link|enabled|disabled|read-only|read-write|required|optional)\b/gi;o=o.replace(p,"")}var p=/:(any-link|link|visited|local-link|enabled|disabled|read-only|read-write|required|optional)\b/gi;p.test(o)&&(e=new h(new k(333),e),o=o.replace(p,""));var p=/:(hover)\b/gi;p.test(o)&&(e=new h(new l,e),o=o.replace(p,"")),-1!==o.indexOf(":")&&(e=new g)}n(e)}var e=b("src/core/dom-experimental-event-streams.js"),f=e.DOMUpdateEventStream,g=e.AnimationFrameEventStream,h=e.CompositeEventStream,i=e.FocusEventStream,j=e.MouseButtonEventStream,k=e.TimeoutEventStream,l=e.MouseEventStream;return d}(window,document),b.define("src/core/dom-query-selector-live.js"),a.exports=function(a,c){b("src/core/polyfill-dom-console.js"),b("src/core/polyfill-dom-requestAnimationFrame.js");var d=b("src/core/css-syntax.js"),e=b("src/core/dom-events.js"),f=b("src/core/dom-query-selector-live.js"),g={computeSelectorPriorityOf:function(a){"string"==typeof a&&(a=d.parse(a.trim()+"{}").value[0].selector);for(var b=0,c=0,e=0,f=0;f<a.length;f++)if(a[f]instanceof d.IdentifierToken)e++;else if(a[f]instanceof d.DelimToken)"."==a[f].value&&(c++,f++);else if(a[f]instanceof d.ColonToken)if(a[++f]instanceof d.ColonToken)e++,f++;else if(a[f]instanceof d.Func&&/^(not|matches)$/i.test(a[f].name)){var g=this.computeSelectorPriorityOf(a[f].value);e+=g%256,g/=256,c+=g%256,g/=256,b+=g}else c++;else a[f]instanceof d.SimpleBlock?"["==a[f].name&&c++:a[f]instanceof d.HashToken&&b++;return b>255&&(numberOfIds=255),c>255&&(c=255),e>255&&(e=255),256*(256*b+c)+e},findAllMatchingRules:function(a){return this.findAllMatchingRulesWithPseudo(a)},findAllMatchingRulesWithPseudo:function(a,b){b=b?(""+b).toLowerCase():b;for(var c=[],e=function(f){try{for(var h=f.length;h--;){var i=f[h];if(!i.disabled)if(i instanceof d.StyleRule)for(var j=i.subRules||g.splitRule(i),k=j.length;k--;){var l=j[k].selector.toCSSString().replace(/ *(\/\*\*\/|  ) */g," ").trim();if(b){var m=l.toLowerCase(),n=l.length-b.length-1;if(0>=n)continue;if(m.lastIndexOf("::"+b)==n-1)l=l.substr(0,n-1);else{if(m.lastIndexOf(":"+b)!=n)continue;l=l.substr(0,n)}0==l.trim().length?l="*":" "==l[l.length-1]?l+="*":"+"==l[l.length-1]?l+="*":">"==l[l.length-1]?l+="*":"~"==l[l.length-1]&&(l+="*")}var o=!1;try{if(a.matches)o=a.matches(l);else if(a.matchesSelector)o=a.matchesSelector(l);else if(a.oMatchesSelector)o=a.oMatchesSelector(l);else if(a.msMatchesSelector)o=a.msMatchesSelector(l);else if(a.mozMatchesSelector)o=a.mozMatchesSelector(l);else{if(!a.webkitMatchesSelector)throw new Error("no element.matches?");o=a.webkitMatchesSelector(l)}}catch(p){setImmediate(function(){throw p})}o&&c.push(j[k])}else i instanceof d.AtRule&&"media"==i.name&&e(i.toStylesheet().value)}}catch(p){setImmediate(function(){throw p})}},f=g.stylesheets.length;f--;){var h=g.stylesheets[f];e(h)}return c},allCSSProperties:null,getAllCSSProperties:function(){if(this.allCSSProperties)return this.allCSSProperties;for(var a=getComputedStyle(c.documentElement),b=new Array(a.length),d=a.length;d--;)b[d]=a[d];return-1==b.indexOf("content")&&b.push("content"),-1==b.indexOf("counter-reset")&&(b.push("counter-reset"),b.push("counter-increment"),g.computationUnsafeProperties["counter-reset"]=!0),this.allCSSProperties=b},computationUnsafeProperties:{bottom:!0,direction:!0,display:!0,"font-size":!0,height:!0,left:!0,"line-height":!0,"margin-left":!0,"margin-right":!0,"margin-bottom":!0,"margin-top":!0,"max-height":!0,"max-width":!0,"min-height":!0,"min-width":!0,"padding-left":!0,"padding-right":!0,"padding-bottom":!0,"padding-top":!0,right:!0,"text-align":!0,"text-align-last":!0,top:!0,width:!0,__proto__:null},inheritingProperties:{"border-collapse":!0,"border-spacing":!0,"caption-side":!0,color:!0,cursor:!0,direction:!0,"empty-cells":!0,"font-family":!0,"font-size":!0,"font-style":!0,"font-variant":!0,"font-weight":!0,font:!0,"letter-spacing":!0,"line-height":!0,"list-style-image":!0,"list-style-position":!0,"list-style-type":!0,"list-style":!0,orphans:!0,quotes:!0,"text-align":!0,"text-indent":!0,"text-transform":!0,visibility:!0,"white-space":!0,widows:!0,"word-break":!0,"word-spacing":!0,"word-wrap":!0,__proto__:null},defaultStylesForTag:Object.create?Object.create(null):{},getDefaultStyleForTag:function(a){
        var b=this.defaultStylesForTag[a];if(b)return b;var d=c.createElement(a),e=this.defaultStylesForTag[a]=getComputedStyle(d);return e.display?e:(c.head.insertBefore(d,c.head.firstChild),e)},getSpecifiedStyle:function(b,e,f){var h;if((h=b.getAttribute("data-css-regions-fragment-of"))&&(h=c.querySelector('[data-css-regions-fragment-source="'+h+'"]')))return g.getSpecifiedStyle(h,e);if(b.currentStyle&&!a.opera){var i=b.myStyle[e]||b.currentStyle[e]||"";return d.parseAListOfComponentValues(i)}try{if(i=b.style.getPropertyValue(e)||b.myStyle[e])return d.parseAListOfComponentValues(i)}catch(j){}var k=!1,l=0,i=new d.TokenList,m=f||(e in g.monitoredProperties?b.myMatchedRules||[]:g.findAllMatchingRules(b)),n=function(a){for(var b=a.length;b--;)if(!a[b].disabled)if(a[b]instanceof d.StyleRule){for(var c=a[b].getDeclarations(),f=c.length-1;f>=0;f--)if("DECLARATION"==c[f].type&&c[f].name==e){var h=g.computeSelectorPriorityOf(a[b].selector);k?c[f].important&&h>=l&&(l=h,i=c[f].value):c[f].important?(k=!0,l=h,i=c[f].value):h>=l&&(l=h,i=c[f].value)}}else a[b]instanceof d.AtRule&&"media"==a[b].name&&n(a[b].toStylesheet())};return n(m),i||null},stylesheets:[],loadStyleSheet:function(a,b){var c=d.parse(a).value;"undefined"!=typeof b?g.stylesheets[b]=c:b=g.stylesheets.push(c),g.startMonitoringStylesheet(c)},loadStyleSheetTag:function(a,b){if(!a.hasAttribute("data-css-polyfilled")){if("LINK"==a.tagName)try{g.stylesheets[b]=new d.TokenList;var c=new XMLHttpRequest;c.href=a.href,c.open("GET",a.href,!0),c.ruleIndex=b,c.onreadystatechange=function(){4==this.readyState&&(200==this.status||0==this.status?g.loadStyleSheet(this.responseText,this.ruleIndex):cssConsole.log("css-cascade polyfill failled to load: "+this.href))},c.send()}catch(e){cssConsole.log("css-cascade polyfill failled to load: "+a.href)}else g.loadStyleSheet(a.textContent,b);a.setAttribute("data-css-polyfilled",!0)}},selectorForStylesheets:"style:not([data-no-css-polyfill]):not([data-css-polyfilled]), link[rel=stylesheet]:not([data-no-css-polyfill]):not([data-css-polyfilled])",loadAllStyleSheets:function(){var a=c.head||c.documentElement,b=a.querySelectorAll(g.selectorForStylesheets),d=this.stylesheets.length;this.stylesheets.length+=b.length;for(var e=b.length;e--;){var f=b[e];g.loadStyleSheetTag(f,d+e)}},monitoredProperties:Object.create?Object.create(null):{},monitoredPropertiesHandler:{onupdate:function(a,b){for(var c=g.monitoredProperties,d=b.getDeclarations(),e=d.length-1;e>=0;e--)if("DECLARATION"==d[e].type&&d[e].name in c){for(var f=c[d[e].name],h=f.length;h--;)f[h].onupdate(a,b);break}}},startMonitoringProperties:function(a,b){for(var c=a.length;c--;){var d=a[c],e=g.monitoredProperties[d]||(g.monitoredProperties[d]=[]);e.push(b)}for(var f=0;f<g.stylesheets.length;f++){var h=g.stylesheets[f];g.startMonitoringStylesheet(h)}},startMonitoringStylesheet:function(b){for(var c=0;c<b.length;c++)if(b[c]instanceof d.StyleRule){if(b[c].isMonitored)continue;for(var e=b[c].getDeclarations(),f=e.length-1;f>=0;f--)if("DECLARATION"==e[f].type&&e[f].name in g.monitoredProperties){g.startMonitoringRule(b[c]);break}}else b[c]instanceof d.AtRule&&"media"==b[c].name&&a.matchMedia&&g.startMonitoringMedia(b[c])},startMonitoringMedia:function(b){try{var c=a.matchMedia(b.prelude.toCSSString()),d=b.toStylesheet().value;g.updateMedia(d,!c.matches,!1),c.addListener(function(a){g.updateMedia(d,!a.matches,!0)}),g.startMonitoringStylesheet(d)}catch(e){setImmediate(function(){throw e})}},updateMedia:function(a,b,d){for(var e=a.length;e--;){a[e].disabled=b;var f=a[e].subRules;if(f)for(var h=f.length;h--;)f[h].disabled=b}if(d)for(var e=a.length;e--;)for(var i=c.querySelectorAll(a[e].selector.toCSSString()),h=i.length;h--;)g.monitoredPropertiesHandler.onupdate(i[h],a[e])},splitRule:function(a){var b=[],c=new d.StyleRule;c.disabled=a.disabled;for(var e=0;e<a.selector.length;e++)a.selector[e]instanceof d.DelimToken&&","==a.selector[e].value?(c.value=a.value,b.push(c),c=new d.StyleRule,c.disabled=a.disabled):c.selector.push(a.selector[e]);return c.value=a.value,b.push(c),a.subRules=b},startMonitoringRule:function(a){if(!a.isMonitored){a.isMonitored=!0;for(var b=a.subRules||g.splitRule(a),c=0;c<b.length;c++)a=b[c],f(a.selector.toCSSString(),{onadded:function(b){(b.myMatchedRules=b.myMatchedRules||[]).unshift(a),g.monitoredPropertiesHandler.onupdate(b,a)},onremoved:function(b){b.myMatchedRules&&b.myMatchedRules.splice(b.myMatchedRules.indexOf(a),1),g.monitoredPropertiesHandler.onupdate(b,a)}})}},toCamelCase:function(a){return a.replace(/-([a-z])/g,function(a,b){return b.toUpperCase()})},polyfillStyleInterface:function(a){var b={get:function(){try{if(!this.parentElement)throw new Error("Please use the anHTMLElement.myStyle property to get polyfilled properties")}catch(b){return setImmediate(function(){throw b}),""}try{return this.clip=void 0===this.clip?"":this.clip,this.parentElement.getAttribute("data-style-"+a)}catch(b){var c=g.getSpecifiedStyle(this.parentElement,a,void 0,!0);return c&&c.length>0?c.toCSSString():""}},set:function(b){this.clip=void 0===this.clip?"":this.clip;try{if(!this.parentElement)throw new Error("Please use the anHTMLElement.myStyle property to set polyfilled properties")}catch(c){return void setImmediate(function(){throw c})}this.parentElement.getAttribute("data-style-"+a)!=b&&this.parentElement.setAttribute("data-style-"+a,b)}},e=[];try{e.push(Object.getPrototypeOf(c.documentElement.style)||CSSStyleDeclaration)}catch(f){}for(var h=e.length;h--;){var i=e[h];Object.defineProperty(i,a,b),Object.defineProperty(i,g.toCamelCase(a),b)}g.startMonitoringRule(d.parse('[style*="'+a+'"]{'+a+":attr(style)}").value[0]),g.startMonitoringRule(d.parse("[data-style-"+a+"]{"+a+":attr(style)}").value[0]),g.getAllCSSProperties().push(a),g.computationUnsafeProperties[a]=!0}};return e.EventTarget.implementsIn(g),Object.defineProperty(Element.prototype,"myStyle",{get:function(){var a=this.style;return a.parentElement||(a.parentElement=this),a}}),"no_auto_stylesheet_detection"in a||(g.loadAllStyleSheets(),c.addEventListener("DOMContentLoaded",function(){g.loadAllStyleSheets(),f(g.selectorForStylesheets,{onadded:function(a){g.loadStyleSheetTag(a),g.dispatchEvent("stylesheetadded")}})})),g}(window,document),b.define("src/core/css-cascade.js"),a.exports=function(a,c){var d=(b("src/core/css-syntax.js"),b("src/core/css-cascade.js")),e={isReplacedElement:function(a){if(!(a instanceof Element))return!1;var b=/^(SVG|MATH|IMG|VIDEO|PICTURE|OBJECT|EMBED|IFRAME|TEXTAREA|BUTTON|INPUT)$/;return b.test(a.tagName)},isScrollable:function(a,b){return a instanceof Element?("undefined"==typeof b&&(b=getComputedStyle(a).overflow),"visible"!==b&&"hidden"!==b):!1},isSingleLineOfTextComponent:function(a,b,c,d,e){return a instanceof Element?("undefined"==typeof b&&(b=getComputedStyle(a)),"undefined"==typeof c&&(c=b.display),"undefined"==typeof d&&(d=b.position),"undefined"==typeof e&&(e=this.isReplacedElement(a)),!("inline-block"!==c&&"inline-table"!==c&&"inline-flex"!==c&&"inline-grid"!==c||"static"!==d&&"relative"!==d)):!0},hasAnyInlineFlow:function(a){function b(a){return a instanceof Element?!e.isOutOfFlowElement(a)&&e.isSingleLineOfTextComponent(a):!/^\s*$/.test(a.nodeValue)}for(var c=a.firstChild;c;){if(b(c))return!0;c=c.nextSibling}return!1},isLineBreakingElement:function(a,b,c,d){return a instanceof Element?("undefined"==typeof b&&(b=getComputedStyle(a)),"undefined"==typeof c&&(c=b.display),"undefined"==typeof d&&(d=b.position),"block"===c&&!this.isOutOfFlowElement(a,b,c,d)||"BR"===a.tagName&&"none"!==c):!1},isLinePreBreakingElement:function(a,b,c,f){if(!(a instanceof Element))return!1;var g=d.getSpecifiedStyle(a,"break-before").toCSSString();return"region"==g||"all"==g||e.isLineBreakingElement(a,b,c,f)},isLinePostBreakingElement:function(a,b,c,f){if(!(a instanceof Element))return!1;var g=d.getSpecifiedStyle(a,"break-after").toCSSString();return"region"==g||"all"==g||e.isLineBreakingElement(a,b,c,f)},isOutOfFlowElement:function(a,b,c,d,e){return a instanceof Element?("undefined"==typeof b&&(b=getComputedStyle(a)),"undefined"==typeof c&&(c=b.display),"undefined"==typeof d&&(d=b.position),"undefined"==typeof e&&(e=b["float"]||b.styleFloat||b.cssFloat),"absolute"===d||"fixed"===d||"none"!==e||"none"===c):!1},areInSameSingleLine:function(a,b){function c(a,b,c){return{top:a.top+c,bottom:a.bottom+c,left:a.left+b,right:a.right+b}}if(a.nextSibling!=b){if(b.nextSibling!=a)throw"I gave up!";var d=a;a=b,b=d}if(this.isLinePostBreakingElement(a))return!1;if(this.isLinePreBreakingElement(b))return!1;if(this.isOutOfFlowElement(a))return!0;if(!this.isSingleLineOfTextComponent(a))return!1;var e=Node.getBoundingClientRect(a),f=Node.getBoundingClientRect(b);if(a instanceof Element){var g=getComputedStyle(a);e=c(e,parseFloat(g.marginLeft),parseFloat(g.marginTop)),"relative"==g.position&&(e=c(e,parseFloat(g.left),parseFloat(g.top)))}if(b instanceof Element){var h=getComputedStyle(b);f=c(f,parseFloat(h.marginLeft),parseFloat(h.marginTop)),"relative"==h.position&&(f=c(f,parseFloat(h.left),parseFloat(h.top)))}var i="rtl"==getComputedStyle(a.parentNode).direction?f:e,j="rtl"==getComputedStyle(a.parentNode).direction?e:f;return i.right<=j.left},isHiddenOverflowing:function(a,b){return a instanceof Element?("undefined"==typeof b&&(b=getComputedStyle(a).display),"hidden"==b&&a.offsetHeight!=a.scrollHeight):!1},hasBigRadius:function(a,b){if(!(a instanceof Element))return!1;if("undefined"==typeof b&&(b=getComputedStyle(a)),"borderTopLeftRadius"in b){var c=parseFloat(b.borderTopLeftRadius),d=parseFloat(b.borderTopRightRadius),e=parseFloat(b.borderBottomLeftRadius),f=parseFloat(b.borderBottomRightRadius);if(15>c&&15>d&&15>e&&15>f)return!1;var g=parseFloat(b.borderTopWidth),h=parseFloat(b.borderBottomWidth),i=parseFloat(b.borderLeftWidth),j=parseFloat(b.borderRightWidth);if(c>g)return!0;if(c>i)return!0;if(d>g)return!0;if(d>j)return!0;if(e>h)return!0;if(e>i)return!0;if(f>h)return!0;if(f>j)return!0}return!1},isBreakInsideAvoid:function(a,b){var c=d.getSpecifiedStyle(a,"break-inside",void 0,!0).toCSSString().trim().toLowerCase();return"avoid"==c||"avoid-region"==c},isMonolithic:function(a){if(!(a instanceof Element))return!1;var b=getComputedStyle(a),c=b.overflow,d=b.display,e=this.isReplacedElement(a),f=this.isScrollable(a,c),g=this.isSingleLineOfTextComponent(a,b,d,void 0,e),h=this.isHiddenOverflowing(a,c),i=this.hasBigRadius(a,b),j=this.isBreakInsideAvoid(a,b);return e||f||g||h||i||j},isPossibleBreakPoint:function(a,b){if(!(a instanceof Range))return!1;if(!a.collapsed)return!1;for(var c=a.startContainer;c&&c!==b;){if(e.isMonolithic(c))return!1;c=c.parentNode}for(var c=a.startContainer,d=a.startContainer.childNodes[a.startOffset];c&&d!==b;){if(d&&d.previousSibling&&this.areInSameSingleLine(d,d.previousSibling))return!1;d=c,c=c.parentNode}if(0==a.startOffset){var f=a.startContainer.childNodes[0];if(!f)return!1;var g=Node.getBoundingClientRect(f),h=a.startContainer.getBoundingClientRect();if(g.top==h.top)return!1}return!0}};return e}(window,document),b.define("src/core/css-break.js"),!document.caretRangeFromPoint)if(document.caretPositionFromPoint)document.caretRangeFromPoint=function(a,b){var c=document.createRange(),d=document.caretPositionFromPoint(a,b);return d.offsetNode&&(c.setStart(d.offsetNode,d.offset),c.setEnd(d.offsetNode,d.offset)),c};else if((document.body||document.createElement("body")).createTextRange){var c={convertToDOMRange:function(a,b){var c=function(a,c,d){var e=b.createElement("a"),f=c.duplicate();f.collapse(d);var g=f.parentElement();do g.insertBefore(e,e.previousSibling),f.moveToElementText(e);while(f.compareEndPoints(d?"StartToStart":"StartToEnd",c)>0&&e.previousSibling);-1==f.compareEndPoints(d?"StartToStart":"StartToEnd",c)&&e.nextSibling?(f.setEndPoint(d?"EndToStart":"EndToEnd",c),a[d?"setStart":"setEnd"](e.nextSibling,f.text.length)):a[d?"setStartBefore":"setEndBefore"](e),e.parentNode.removeChild(e)};b||(b=window.document);var d=b.createRange();return c(d,a,!0),c(d,a,!1),d},convertFromDOMRange:function(a){var b=function(a,b,c){var d=b[c?"startContainer":"endContainer"],e=b[c?"startOffset":"endOffset"],f=0,g=DOMUtils.isDataNode(d)?d:d.childNodes[e],h=DOMUtils.isDataNode(d)?d.parentNode:d;(3==d.nodeType||4==d.nodeType)&&(f=e);var i=b._document.createElement("a");h.insertBefore(i,g);var j=b._document.body.createTextRange();j.moveToElementText(i),i.parentNode.removeChild(i),a.setEndPoint(c?"StartToStart":"EndToStart",j),a[c?"moveStart":"moveEnd"]("character",f)},c=a._document.body.createTextRange();return b(c,a,!0),b(c,a,!1),c}};document.caretRangeFromPoint=function(a,b){for(var d=40,e=document.body.createTextRange(),f=d;f;f-=4){var g=a;try{return e.moveToPoint(g,f+b-d),c.convertToDOMRange(e)}catch(h){}}try{var i=document.elementFromPoint(a-1,b-1),e=document.createRange();return e.setStartAfter(i),e}catch(h){return null}}}Range.prototype.myMoveOneCharLeft=function(){var a=this;if(a.endOffset>0){var b=a.endContainer.childNodes[a.endOffset-1];b&&b.lastChild?a.setEndAfter(b.lastChild):b&&b.nodeType==b.TEXT_NODE?a.setEnd(b,b.nodeValue.length):a.setEnd(a.endContainer,a.endOffset-1)}else a.setEndBefore(a.endContainer)},Range.prototype.myMoveOneCharRight=function(){var a=this,b=a.startContainer.nodeType==a.startContainer.TEXT_NODE?a.startContainer.nodeValue.length:a.startContainer.childNodes.length;if(a.startOffset<b){var c=a.endContainer.childNodes[a.endOffset];c&&c.firstChild?a.setStartBefore(c.firstChild):c&&c.nodeType==c.TEXT_NODE&&""!=c.nodeValue?a.setStart(c,0):a.setStart(a.startContainer,a.startOffset+1)}else a.setStartAfter(a.endContainer);a.setEnd(a.startContainer,a.startOffset)},Range.prototype.myMoveTowardRight=function(){var a=this,b=a.startContainer.nodeType==a.startContainer.TEXT_NODE,c=b?a.startContainer.nodeValue.length:a.startContainer.childNodes.length;if(a.startOffset<c){var d=a.endContainer.childNodes[a.endOffset];if(d&&d.firstChild)a.setStartBefore(d.firstChild);else if(d&&d.nodeType==d.TEXT_NODE&&""!=d.nodeValue)a.setStart(d,0);else if(b){for(var e=a.startContainer.nodeValue,f=a.startOffset,g=e[f++];c>f&&/^\w$/.test(g);)g=e[f++];a.setStart(a.startContainer,f)}else a.setStart(a.startContainer,a.startOffset+1)}else a.setStartAfter(a.endContainer);a.setEnd(a.startContainer,a.startOffset)},Range.prototype.myMoveEndOneCharLeft=function(){var a=this;if(a.endOffset>0){var b=a.endContainer.childNodes[a.endOffset-1];b&&b.lastChild?a.setEndAfter(b.lastChild):b&&b.nodeType==b.TEXT_NODE?a.setEnd(b,b.nodeValue.length):a.setEnd(a.endContainer,a.endOffset-1)}else a.setEndBefore(a.endContainer)},Range.prototype.myMoveEndOneCharRight=function(){var a=this,b=a.endContainer.nodeType==a.endContainer.TEXT_NODE?a.endContainer.nodeValue.length:a.endContainer.childNodes.length;if(a.endOffset<b){var c=a.endContainer.childNodes[a.endOffset];c&&c.firstChild?a.setEndBefore(c.firstChild):c&&c.nodeType==c.TEXT_NODE?a.setEnd(c,0):a.setEnd(a.endContainer,a.endOffset+1)}else a.setEndAfter(a.endContainer)},Range.prototype.myGetSelectionRect=function(){var a=this.getBoundingClientRect();if(a||(a={top:0,right:0,bottom:0,left:0,width:0,height:0}),this.collapsed&&0===a.top&&0===a.bottom){var b=this.cloneRange(),c=!1;b.collapse(!1),0==b.startOffset?(b.myMoveTowardRight(),c=!0,b.setStart(b.endContainer,0)):(b.setStart(this.startContainer,this.startOffset-1),c=!1);var a=b.myGetSelectionRect();return c?{left:a.left,right:a.left,width:0,top:a.top,bottom:a.bottom,height:a.height}:{left:a.right,right:a.right,width:0,top:a.top,bottom:a.bottom,height:a.height}}return a},window.Element||(window.Element=window.HTMLElement),window.Node||(window.Node={}),Node.getBoundingClientRect=function(a){if(a.getBoundingClientRect)var b=a.getBoundingClientRect();else{var c=document.createRange();c.selectNode(a);var b=c.getBoundingClientRect()}return b||(b={top:0,right:0,bottom:0,left:0,width:0,height:0}),b},Node.getClientRects=function(a){if(a.getBoundingClientRect)return a.getClientRects();var b=document.createRange();return b.selectNode(a),b.getClientRects()},Node.contains=function(a,b){return 1!=b.nodeType?b.parentNode?b.parentNode==a||a.contains(b.parentNode):!1:a.contains(b)},Range.prototype.myGetExtensionRect=function(){var a=this.myGetSelectionRect(),b=this.endContainer.childNodes[this.endOffset-1];if(b){var c=Node.getBoundingClientRect(b),d=Math.max(a.bottom,c.bottom);return d==a.bottom?a:{left:a.left,right:a.right,width:a.width,top:a.top,bottom:d,height:d-a.top}}if(0==this.bottom&&3===this.endContainer.nodeType){var e=/^(\s|\n)*$/.test(this.endContainer.nodeValue.substr(0,this.endOffset));if(e){var c=Node.getClientRects(this.endContainer)[0];return c}var f=this.cloneRange();f.setStart(this.endContainer,0);var c=f.getBoundingClientRect(),d=Math.max(a.bottom,c.bottom);return{left:a.left,right:a.right,width:a.width,top:a.top,bottom:d,height:d-a.top}}return a},b.define("src/css-regions/lib/range-extensions.js"),a.exports=function(a,c){var d=b("src/core/dom-events.js"),e=(b("src/core/css-syntax.js"),b("src/core/css-cascade.js")),f=(b("src/core/css-break.js"),a.cssRegionsHelpers={getAllLevelPreviousSibling:function(a,b){if(!a||a==b)return null;for(;!a.previousSibling;)if(a=a.parentNode,!a||a==b)return null;return a.previousSibling},markNodesAsRegion:function(a,b){a.forEach(function(a){a.regionOverset="empty",a.setAttribute("data-css-region",a.cssRegionsLastFlowFromName),f.hideTextNodesFromFragmentSource([a]),a.cssRegionsWrapper=a.cssRegionsWrapper||a.appendChild(c.createElement("cssregion"))})},unmarkNodesAsRegion:function(a,b){a.forEach(function(a){a.regionOverset="fit";try{a.cssRegionsWrapper&&a.removeChild(a.cssRegionsWrapper)}catch(b){setImmediate(function(){throw b})}a.cssRegionsWrapper=void 0,delete a.cssRegionsWrapper,f.unhideTextNodesFromFragmentSource([a]),a.removeAttribute("data-css-region")})},fragmentSourceIndex:0,markNodesAsFragmentSource:function(a,b){function c(a,d){var e,g;switch(a.nodeType){case 1:if("undefined"==typeof d||!b){var h=a.getAttributeNode("data-css-regions-fragment-source");h||a.setAttribute("data-css-regions-fragment-source",f.fragmentSourceIndex++)}a.setAttribute("data-css-regions-cloning",!0),"OL"==a.tagName&&f.expandListValues(a),"undefined"!=typeof d&&"LI"==a.tagName&&f.expandListValues(a.parentNode);case 9:case 11:for(e=a.firstChild;e;)g=e.nextSibling,c(e),e=g}}a.forEach(c)},expandListValues:function(a){if(!a.getAttribute("data-css-li-value-expanded")){if(a.setAttribute("data-css-li-value-expanded",!0),a.hasAttribute("reversed"))var b=a.getAttribute("start")?parseInt(a.getAttribute("start")):a.childElementCount,c=-1;else var b=a.getAttribute("start")?parseInt(a.getAttribute("start")):1,c=1;for(var d=a.firstElementChild,e=null;d;)"LI"===d.tagName&&((e=d.getAttributeNode("value"))?(b=parseInt(e.nodeValue),d.setAttribute("data-css-old-value",b)):d.setAttribute("value",b),b+=c),d=d.nextElementSibling}},unexpandListValues:function(a){if(a.hasAttribute("data-css-li-value-expanded")){a.removeAttribute("data-css-li-value-expanded");for(var b=a.firstElementChild,c=null;b;)"LI"===b.tagName&&((c=b.getAttributeNode("data-css-old-value"))?b.removeAttributeNode(c):b.removeAttribute("value")),b=b.nextElementSibling}},listOfTextNodesForIE:[],hideTextNodesFromFragmentSource:function(a){function b(a,c){var d,e;switch(a.nodeType){case 3:a.parentNode.getAttribute("data-css-regions-fragment-source")||(a.cssRegionsSavedNodeValue=a.nodeValue,a.nodeValue="",(navigator.userAgent.indexOf("MSIE")>0||navigator.userAgent.indexOf("Trident")>0)&&-1==f.listOfTextNodesForIE.indexOf(a)&&f.listOfTextNodesForIE.push(a));break;case 1:if(a.hasAttribute("data-css-regions-cloning")&&(a.removeAttribute("data-css-regions-cloning"),a.setAttribute("data-css-regions-cloned",!0),a.currentStyle&&a.currentStyle.display.toString()),"undefined"==typeof c)return;case 9:case 11:for(d=a.firstChild;d;)e=d.nextSibling,b(d),d=e}}a.forEach(b)},unhideTextNodesFromFragmentSource:function(a){function b(a){var c,d;switch(a.nodeType){case 3:"cssRegionsSavedNodeValue"in a&&(a.nodeValue=a.cssRegionsSavedNodeValue,delete a.cssRegionsSavedNodeValue);break;case 1:if("undefined"==typeof k)return;case 9:case 11:for(c=a.firstChild;c;)d=c.nextSibling,b(c),c=d}}a.forEach(b)},unmarkNodesAsFragmentSource:function(a){function b(a,c){var d,e;switch(a.nodeType){case 3:"cssRegionsSavedNodeValue"in a&&(a.nodeValue=a.cssRegionsSavedNodeValue,delete a.cssRegionsSavedNodeValue);break;case 1:a.removeAttribute("data-css-regions-cloned"),a.removeAttribute("data-css-regions-fragment-source"),a.currentStyle&&a.currentStyle.display.toString(),"OL"==a.tagName&&f.unexpandListValues(a),"undefined"!=typeof c&&"LI"==a.tagName&&f.unexpandListValues(a.parentNode);case 9:case 11:for(d=a.firstChild;d;)e=d.nextSibling,b(d),d=e}}a.forEach(b)},transformFragmentSourceToFragments:function(a){function b(a){var c,d;switch(a.nodeType){case 1:var e=a.getAttribute("data-css-regions-fragment-source");a.removeAttribute("data-css-regions-fragment-source"),a.removeAttribute("data-css-regions-cloning"),a.removeAttribute("data-css-regions-cloned"),a.setAttribute("data-css-regions-fragment-of",e),a.id&&(a.id+="--fragment");case 9:case 11:for(c=a.firstChild;c;)d=c.nextSibling,b(c),c=d}}a.forEach(b)},embedTrailingWhiteSpaceNodes:function(a){function b(a){var d,e;switch(a.nodeType){case 3:if(!a.previousSibling){"pre"!==getComputedStyle(a.parentNode).whiteSpace.substring(0,3)&&c.test(a.nodeValue)&&(a.parentNode.setAttribute("data-whitespace-before",a.nodeValue),a.parentNode.removeChild(a));break}if(!a.nextSibling){"pre"!==getComputedStyle(a.parentNode).whiteSpace.substring(0,3)&&c.test(a.nodeValue)&&(a.parentNode.setAttribute("data-whitespace-after",a.nodeValue),a.parentNode.removeChild(a));break}break;case 1:case 9:case 11:for(d=a.firstChild;d;)e=d.nextSibling,b(d),d=e}}var c=/^\s*$/;b(a)},unembedTrailingWhiteSpaceNodes:function(a){function b(a){var d,e;switch(a.nodeType){case 1:var f="";(f=a.getAttribute("data-whitespace-before"))&&""==a.getAttribute("data-starting-fragment")&&a.getAttribute("data-special-starting-fragment","")&&a.insertBefore(c.createTextNode(f),a.firstChild),a.removeAttribute("data-whitespace-before"),(f=a.getAttribute("data-whitespace-after"))&&""==a.getAttribute("data-continued-fragment")&&a.getAttribute("data-special-continued-fragment","")&&a.insertAfter(c.createTextNode(f),a.lastChild),a.removeAttribute("data-whitespace-after");case 9:case 11:for(d=a.firstChild;d;)e=d.nextSibling,b(d),d=e}}b(a)},copyStyle:function(b,d){function g(b,d,h){var i,j,k,l;switch(b.nodeType){case 1:for(var m=b.currentStyle&&!a.opera?void 0:e.findAllMatchingRules(b),n=e.allCSSProperties||e.getAllCSSProperties(),o=n.length;o--;)if(n[o]in e.computationUnsafeProperties||"-"==n[o][0]){var p=e.getSpecifiedStyle(b,n[o],m);if(p&&p.length)d.style.setProperty(n[o],p.toCSSString());else if(h&&b.parentNode&&"-"!=n[o][0]){if(!(n[o]in e.inheritingProperties))continue;if("font-size"==n[o]||!(n[o]in e.computationUnsafeProperties)&&"-"!=n[o][0]){var q=getComputedStyle(b).getPropertyValue(n[o]);d.style.setProperty(n[o],q);continue}var p=e.getSpecifiedStyle(b,n[o],m);p&&p.length&&d.style.setProperty(n[o],p.toCSSString())}}else{var q=getComputedStyle(b).getPropertyValue(n[o]),r=e.getDefaultStyleForTag(b.tagName).getPropertyValue(n[o]);q!=r&&d.style.setProperty(n[o],q)}var s=function(a,b,d){var f=!!e.findAllMatchingRulesWithPseudo(a,d.substr(1)).length;if(f){var g=getComputedStyle(a,d);if("none"!=g.content){var h=c.createElement("style");h.setAttribute("data-no-css-polyfill",!0);for(var i="",j=e.allCSSProperties||e.getAllCSSProperties(),k=j.length;k--;){var l=g.getPropertyValue(j[k]);i+=j[k]+":"+l+";"}h.textContent='[data-css-regions-fragment-of="'+a.getAttribute("data-css-regions-fragment-source")+'"]:not([data-css-regions-starting-fragment]):not([data-css-regions-special-starting-fragment]):'+d+"{"+i+"}",b.parentNode.insertBefore(h,b)}}};s(b,d,":before"),s(b,d,":after"),f.retargetEvents(b,d);case 9:case 11:for(i=b.firstChild,k=d.firstChild;i;)j=i.nextSibling,l=k.nextSibling,i.cssRegionsLastFlowIntoName&&"element"===i.cssRegionsLastFlowIntoType?d.removeChild(k):g(i,k),i=j,k=l}}g(b,d,!0)},retargetEvents:function(a,b){var c="cssRegionsHelpers.retargetEvent(this,event)";b.setAttribute("onclick",c),b.setAttribute("ondblclick",c),b.setAttribute("onmousedown",c),b.setAttribute("onmouseup",c),b.setAttribute("onmousein",c),b.setAttribute("onmouseout",c),b.setAttribute("onmouseenter",c),b.setAttribute("onmouseleave",c)},retargetEvent:function(a,b){var e=a.cssRegionsFragmentSource||(a.cssRegionsFragmentSource=c.querySelector('[data-css-regions-fragment-source="'+a.getAttribute("data-css-regions-fragment-of")+'"]'));if(e){var f=d.cloneEvent(b);if(e.dispatchEvent(f),b.stopImmediatePropagation?b.stopImmediatePropagation():b.stopPropagation(),f.isDefaultPrevented||f.defaultPrevented)return b.preventDefault(),!1}}});return f}(window,document),b.define("src/css-regions/lib/helpers.js"),a.exports=function(a,c,d){var e=b("src/core/dom-events.js"),f=(b("src/core/css-syntax.js"),b("src/core/css-cascade.js")),g=(b("src/core/css-break.js"),b("src/css-regions/lib/helpers.js")),h=b("src/core/dom-experimental-event-streams.js");d.Flow=function(a){this.name=a,Object.defineProperty(this,"name",{get:function(){return a}}),this.overset=!1,this.firstEmptyRegionIndex=-1,this.content=[],this.lastContent=[],this.regions=[],this.lastRegions=[],this.eventListeners={regionfragmentchange:[],regionoversetchange:[]};var b=this;b.update=function(a){a.schedule(b.update),b.relayout()},b.lastStylesheetAdded=0,f.addEventListener("stylesheetadded",function(){b.lastStylesheetAdded-Date()>100?(b.lastStylesheetAdded=+Date(),b.relayout()):cssConsole.warn("Please don't add stylesheets as a response to region events. Operation cancelled.")}),b.failedLayoutCount=0,b.lastEventRAF=0,b.restartLayout=!1},d.Flow.prototype.removeFromContent=function(a){this.removeEventListenersOf(a);var b=this.content.indexOf(a);b>=0&&this.content.splice(b,1)},d.Flow.prototype.removeFromRegions=function(a){this.removeEventListenersOf(a);var b=this.regions.indexOf(a);b>=0&&this.regions.splice(b,1)},d.Flow.prototype.addToContent=function(a){var b=this.content,d=c.createTreeWalker(c.documentElement,NodeFilter.SHOW_ELEMENT,function(a){return b.indexOf(a)>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT},!1);d.currentNode=a,d.nextNode()?b.splice(b.indexOf(d.currentNode),0,a):b.push(a)},d.Flow.prototype.addToRegions=function(a){var b=this.regions,d=c.createTreeWalker(c.documentElement,NodeFilter.SHOW_ELEMENT,function(a){return b.indexOf(a)>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT},!1);d.currentNode=a,d.nextNode()?b.splice(this.regions.indexOf(d.currentNode),0,a):b.push(a)},d.Flow.prototype.generateContentFragment=function(){for(var a=c.createDocumentFragment(),b=0;b<this.content.length;b++){var d=this.content[b];if(g.markNodesAsFragmentSource([d],"content"==d.cssRegionsLastFlowIntoType),"element"==d.cssRegionsLastFlowIntoType){var e=d,f=e.cloneNode(!0),h=f;"LI"==h.tagName&&(h=c.createElement(e.parentNode.tagName),h.style.margin="0",h.style.padding="0",h.appendChild(f)),a.appendChild(h),g.copyStyle(e,f)}else for(var e=d.firstChild;e;){var f=e.cloneNode(!0),h=f;"LI"==h.tagName&&(h=c.createElement(e.parentNode.tagName),h.style.margin="0",h.style.padding="0",h.appendChild(f)),a.appendChild(h),g.copyStyle(e,f),e=e.nextSibling}}return g.hideTextNodesFromFragmentSource(this.content),g.transformFragmentSourceToFragments(Array.prototype.slice.call(a.childNodes,0)),a},d.Flow.prototype.relayout=function(){var a=this;if(cancelAnimationFrame(a.lastEventRAF),!a.relayoutScheduled){if(a.relayoutInProgress)return void(a.restartLayout=!0);a.relayoutScheduled=!0,requestAnimationFrame(function(){a._relayout()})}},d.Flow.prototype._relayout=function(b){var e=this;try{cssConsole.log("starting a new relayout for "+e.name),e.relayoutInProgress=!0,e.relayoutScheduled=!1,e.lastRelayout=+new Date;var f=b&&b.docElmScrollTop?b.docElmScrollTop:c.documentElement.scrollTop,h=b&&b.docBdyScrollTop?b.docBdyScrollTop:c.body.scrollTop;e.removeEventListenersOf(e.lastRegions),e.removeEventListenersOf(e.lastContent),cancelAnimationFrame(e.lastEventRAF),e.regions=e.regions.filter(function(a){return c.documentElement.contains(a)}),e.content=e.content.filter(function(a){return c.documentElement.contains(a)}),g.unmarkNodesAsRegion(e.lastRegions),e.lastRegions=e.regions.slice(0),g.unmarkNodesAsFragmentSource(e.lastContent),e.lastContent=e.content.slice(0),g.markNodesAsRegion(e.regions);var i=e.regions.slice(0).reverse(),j=e.generateContentFragment();d.layoutContent(i,j,{onprogress:function(a){c.documentElement.scrollTop=f,c.body.scrollTop=h,e.restartLayout?(e.relayoutInProgress=!1,e.failedLayoutCount=0,e.restartLayout=!1,e._relayout({docElmScrollTop:f,docBdyScrollTop:h})):setImmediate(a)},ondone:function(b){for(e.overset=b,e.firstEmptyRegionIndex=e.regions.length-1;e.regions[e.firstEmptyRegionIndex];){var d=!1;if(d=d||!e.regions[e.firstEmptyRegionIndex].cssRegionsWrapper,d=d||!e.regions[e.firstEmptyRegionIndex].cssRegionsWrapper.firstChild,!d){++e.firstEmptyRegionIndex==e.regions.length&&(e.firstEmptyRegionIndex=-1);break}e.firstEmptyRegionIndex--}if(a.MutationObserver?(e.addEventListenersTo(e.content),e.addEventListenersTo(e.regions)):setImmediate(function(){e.addEventListenersTo(e.content)}),e.regions.length>0&&!e.restartLayout){var g=!1;g=g||e.regions.some(function(a){return!c.documentElement.contains(a)}),g=g||e.content.some(function(a){return!c.documentElement.contains(a)}),g?(cssConsole.warn("Buggy css regions layout: the page changed; we need to restart."),e.restartLayout=!0):e.lastEventRAF=requestAnimationFrame(function(){e.dispatchEvent("regionfragmentchange"),e.dispatchEvent("regionoversetchange")})}c.documentElement.scrollTop=f,c.body.scrollTop=h,e.relayoutInProgress=!1,e.failedLayoutCount=0,e.restartLayout&&(e.restartLayout=!1,e.relayout())}})}catch(k){setImmediate(function(){throw k}),e.failedLayoutCount++,e.failedLayoutCount<7?requestAnimationFrame(function(){e._relayout()}):(e.failedLayoutCount=0,e.relayoutScheduled=!1,e.relayoutInProgress=!1,e.restartLayout=!1)}},d.Flow.prototype.relayoutIfSizeChanged=function(){for(var a=this.regions,b=a.length;b--;)if(a[b].offsetHeight!==a[b].cssRegionsLastOffsetHeight||a[b].offsetWidth!==a[b].cssRegionsLastOffsetWidth)return void this.relayout()},d.Flow.prototype.addEventListenersTo=function(a){var b=this;a instanceof Element&&(a=[a]),a.forEach(function(a){a.cssRegionsEventStream||(a.cssRegionsEventStream=new h.DOMUpdateEventStream({target:a}),a.cssRegionsEventStream.schedule(b.update))})},d.Flow.prototype.removeEventListenersOf=function(a){a instanceof Element&&(a=[a]),a.forEach(function(a){a.cssRegionsEventStream&&(a.cssRegionsEventStream.dispose(),delete a.cssRegionsEventStream)})},d.NamedFlow=d.Flow,d.NamedFlow.prototype.getContent=function(){return this.content.slice(0)},d.NamedFlow.prototype.getRegions=function(){return this.regions.slice(0)},d.NamedFlow.prototype.getRegionsByContent=function(a){for(var b=[],d=c.querySelectorAll('[data-css-regions-fragment-of="'+a.getAttribute("data-css-regions-fragment-source")+'"]'),e=0;e<d.length;e++){var f=d[e];do if(f.getAttribute("data-css-region")){b.push(f);break}while(f=f.parentNode)}return b},e.EventTarget.implementsIn(d.Flow),d.NamedFlowCollection=function(){this.length=0},d.NamedFlowCollection.prototype.namedItem=function(a){return d.flows[a]||(d.flows[a]=new d.Flow(a))},d.enablePolyfillObjectModel=function(){c.getNamedFlows=function(){var a=new d.NamedFlowCollection,b=d.flows;for(var c in d.flows)Object.prototype.hasOwnProperty.call(b,c)&&(0!=b[c].content.length||0!=b[c].regions.length)&&(a[a.length++]=a[c]=b[c]);return a},c.getNamedFlow=function(a){var b=d.flows;return b[a]||(b[a]=new d.NamedFlow(a))},Object.defineProperties(Element.prototype,{regionOverset:{get:function(){return this._regionOverset||"fit"},set:function(a){this._regionOverset=a}},getRegionFlowRanges:{value:function(){return null}},getComputedRegionStyle:{value:function(a,b){var d=c.querySelector('[data-css-regions-fragment-of="'+a.getAttribute("data-css-regions-fragment-source")+'"]');
        return b?getComputedStyle(d||a,b):getComputedStyle(d||a)}}}),f.polyfillStyleInterface("flow-into"),f.polyfillStyleInterface("flow-from"),f.polyfillStyleInterface("region-fragment"),f.polyfillStyleInterface("break-before"),f.polyfillStyleInterface("break-after")},"cssRegionsManualTrigger"in a||d.enablePolyfill()},b.define("src/css-regions/lib/objectmodel.js"),a.exports=function(a,c){var d=(b("src/core/dom-events.js"),b("src/core/css-syntax.js")),e=b("src/core/css-cascade.js"),f=b("src/core/css-break.js");b("src/css-regions/lib/range-extensions.js");var g=b("src/css-regions/lib/helpers.js"),h=b("src/css-regions/lib/objectmodel.js"),i="cssregion,[data-css-region]>*,[data-css-regions-fragment-source]:not([data-css-regions-cloning]),[data-css-regions-fragment-source][data-css-regions-cloned]{display:none!important}[data-css-region]>cssregion:last-of-type{display:inline!important}[data-css-region]{content:normal!important}[data-css-special-continued-fragment]{counter-reset:none!important;counter-increment:none!important;margin-bottom:0!important;border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}[data-css-continued-fragment]{counter-reset:none!important;counter-increment:none!important;margin-bottom:0!important;padding-bottom:0!important;border-bottom:none!important;border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}[data-css-continued-fragment]::after{content:none!important;display:none!important}[data-css-special-starting-fragment]{text-indent:0!important;margin-top:0!important}[data-css-starting-fragment]{text-indent:0!important;margin-top:0!important;padding-top:0!important;border-top:none!important;border-top-left-radius:0!important;border-top-right-radius:0!important}[data-css-starting-fragment]::before{content:none!important;display:none!important}[data-css-continued-block-fragment][data-css-continued-fragment]:not(:empty)::after{content:''!important;display:inline-block!important;width:100%!important;height:0!important;font-size:0!important;line-height:0!important;margin:0!important;padding:0!important;border:0!important}",j={layoutContent:function(a,b,c,d){if(!a)return c.ondone(!!b.hasChildNodes());if(!a.length)return c.ondone(!!b.hasChildNodes());d||(d=Date.now());for(var e=a.pop();;){var f=getComputedStyle(e).display;if("none"==f||-1!==f.indexOf("inline")){if(e=a.pop())continue;return c.ondone(!!b.hasChildNodes())}break}if(e.cssRegionsWrapper?(e.cssRegionsWrapper.cssRegionHost=e,e=e.cssRegionsWrapper):e.cssRegionHost=e,e.innerHTML="",!b.hasChildNodes()){e.cssRegionHost.cssRegionsLastOffsetHeight=e.cssRegionHost.offsetHeight,e.cssRegionHost.cssRegionsLastOffsetWidth=e.cssRegionHost.offsetWidth,e.cssRegionHost.regionOverset="empty";var g={ondone:function(){},onprogress:function(a){a()}};return j.layoutContent(a,b,g,d),c.ondone(!1)}return e.appendChild(b),0!==a.length?this.layoutContentInNextRegionsWhenReady(e,a,b,c,d):this.layoutContentInLastRegionWhenReady(e,a,b,c,d)},layoutContentInNextRegionsWhenReady:function(a,b,d,f,g){for(var h=a.getElementsByTagName("img"),i=h.length;i--;)if(!h[i].complete&&!h[i].hasAttribute("height"))return setTimeout(function(){this.layoutContentInNextRegionsWhenReady(a,b,d,f,g+32)}.bind(this),16);var k=a.cssRegionHost.scrollHeight!=a.cssRegionHost.offsetHeight,l=k;if(!l)for(var m=a.firstElementChild,n=a.lastElementChild,o=m;o;){if(o!=m&&/(region|all|always)/i.test(e.getSpecifiedStyle(o,"break-before",void 0,!0).toCSSString())){l=!0;break}if(o!=n&&/(region|all|always)/i.test(e.getSpecifiedStyle(o,"break-after",void 0,!0).toCSSString())){o=o.nextElementSibling,l=!0;break}o=o.nextElementSibling}return d=l?this.extractOverflowingContent(a):c.createDocumentFragment(),d.hasChildNodes()?a.cssRegionHost.regionOverset="overset":a.cssRegionHost.regionOverset="fit",a.cssRegionHost.cssRegionsLastOffsetHeight=a.cssRegionHost.offsetHeight,a.cssRegionHost.cssRegionsLastOffsetWidth=a.cssRegionHost.offsetWidth,g+200>Date.now()?j.layoutContent(b,d,f,g):f.onprogress(function(){j.layoutContent(b,d,f)})},layoutContentInLastRegionWhenReady:function(a,b,c,d,f){for(var g=a.getElementsByTagName("img"),h=g.length;h--;)if(!g[h].complete&&!g[h].hasAttribute("height"))return setTimeout(function(){this.layoutContentInLastRegionWhenReady(a,b,c,d,f+32)}.bind(this),32);if("break"==e.getSpecifiedStyle(a.cssRegionHost,"region-fragment",void 0,!0).toCSSString().trim().toLowerCase()){var i=this.extractOverflowingContent(a).hasChildNodes();return a.cssRegionHost.cssRegionsLastOffsetHeight=a.cssRegionHost.offsetHeight,a.cssRegionHost.cssRegionsLastOffsetWidth=a.cssRegionHost.offsetWidth,d.ondone(i)}return a.cssRegionHost.cssRegionsLastOffsetHeight=a.cssRegionHost.offsetHeight,a.cssRegionHost.cssRegionsLastOffsetWidth=a.cssRegionHost.offsetWidth,d.ondone(a.cssRegionHost.offsetHeight!=a.cssRegionHost.scrollHeight)},extractOverflowingContent:function(a,b){g.embedTrailingWhiteSpaceNodes(a);var d=a.cssRegionHost.offsetHeight,h=a.cssRegionHost.offsetWidth,i=a.cssRegionHost.getBoundingClientRect();i={top:i.top,bottom:i.bottom,left:i.left,right:i.right};var j=parseInt(getComputedStyle(a.cssRegionHost).paddingBottom);j+=parseInt(getComputedStyle(a.cssRegionHost).borderBottomWidth),i.bottom-=j,d-=j;try{var k=b?c.createRange():c.caretRangeFromPoint(i.left+h-1,i.top+d-1)}catch(l){try{cssConsole.error(l.message),cssConsole.dir(l)}catch(l){}}var m=function(){},n=function(){if(0==o.bottom&&0==o.top&&0==o.left&&0==o.right){var a=-(c.documentElement.scrollTop||c.body.scrollTop),b=-(c.documentElement.scrollLeft||c.body.scrollLeft);o={width:0,heigth:0,top:a,bottom:a,left:b,right:b}}};(!k||a!==k.endContainer&&!Node.contains(a,k.endContainer))&&(k&&k.endContainer===a.cssRegionHost&&k.endOffset==k.endContainer.childNodes.length?(k.setStart(a,a.childNodes.length),k.setEnd(a,a.childNodes.length)):(k=k||c.createRange(),k.setStart(a,0),k.setEnd(a,0),b=!0));do{var o=k.myGetExtensionRect();for(n(),m();(k.endContainer!=a||k.endOffset!=k.endContainer.childNodes.length)&&o.bottom<=i.top+d;){m();var p=k.endContainer.childNodes[k.endOffset],q=!p||Node.getBoundingClientRect(p);p&&q.bottom<=i.top+d?(k.setStartAfter(p),k.setEndAfter(p),o=q,n()):(k.myMoveTowardRight(),o=k.myGetExtensionRect(),n())}for(;(k.endContainer!=a||0!=k.endOffset)&&o.bottom>i.top+d;)m(),k.myMoveOneCharLeft(),o=k.myGetExtensionRect(),n();m();var r=!1;if(!b)for(var s=k.endContainer;s=g.getAllLevelPreviousSibling(s,a);)if(Node.getBoundingClientRect(s).bottom>i.top+d){k.setStart(a,0),k.setEnd(a,0),r=!0,b=!0;break}}while(r);for(var s=k.endContainer;s!==a;)f.isMonolithic(s)&&k.setEndBefore(s),s=s.parentNode;(!k||a!==k.endContainer&&!Node.contains(a,k.endContainer))&&(cssConsole.dir(k.cloneRange()),k.setStart(a,a.childNodes.length),k.setEnd(a,a.childNodes.length));var t=k.startContainer.childNodes[k.startOffset],s=t;if(f.hasAnyInlineFlow(k.startContainer))for(;s&&(s=s.previousSibling)&&f.areInSameSingleLine(s,t);)if(t=s,s instanceof Element)k.setEndBefore(s);else{var u=Node.getClientRects(s);if(u.length>1){var v=u[u.length-2].bottom;for(k.setEnd(s,s.nodeValue.length);o.bottom>v;)k.myMoveOneCharLeft(),o=k.myGetExtensionRect(),n();k.endContainer!==s&&k.setEndBefore(s)}else k.setEndBefore(s)}if((!k||a!==k.endContainer&&!Node.contains(a,k.endContainer))&&(cssConsole.dir(k.cloneRange()),k.setStart(a,a.childNodes.length),k.setEnd(a,a.childNodes.length)),k.endContainer===a&&0===k.endOffset&&k.endOffset!==a.childNodes.length)do{k.myMoveTowardRight();for(var s=k.endContainer;s&&s!==a;)f.isMonolithic(s)&&(k.setStartAfter(s),k.setEndAfter(s)),s=s.parentNode}while(!f.isPossibleBreakPoint(k,a)&&(k.endContainer!==a||k.endOffset!==a.childNodes.length));(!k||a!==k.endContainer&&!Node.contains(a,k.endContainer))&&(cssConsole.dir(k.cloneRange()),k.setStart(a,a.childNodes.length),k.setEnd(a,a.childNodes.length));var s=k.endContainer;s.hasChildNodes()&&k.endOffset>0&&(s=s.childNodes[k.endOffset-1]);var t=k.endContainer.firstChild;do s.style&&(s!=t&&/(region|all|always)/i.test(e.getSpecifiedStyle(s,"break-before",void 0,!0).toCSSString())&&(k.setStartBefore(s),k.setEndBefore(s),b=!0),s!==a&&/(region|all|always)/i.test(e.getSpecifiedStyle(s,"break-after",void 0,!0).toCSSString())&&(k.setStartAfter(s),k.setEndAfter(s),b=!0));while(s=g.getAllLevelPreviousSibling(s,a));var s=k.endContainer,w=[];for(s.nodeType!==s.ELEMENT_NODE&&(s=s.parentNode);s!==a;)w.push(s),s=s.parentNode;if(k.endOffset==k.endContainer.childNodes.length&&k.endContainer!==a){var x=k.endContainer.getBoundingClientRect(),y=x.bottom-(i.top+d),z=getComputedStyle(k.endContainer),A=parseFloat(z.borderBottomWidth),B=parseFloat(z.paddingBottom),C=y;if(y>A){C=A,y-=C;var D=y;D>B?(D=B,y-=D):y=0}else y=0;if("number"==typeof C&&0!==C){var E=parseInt(z.borderBottomLeftRadius)>0||parseInt(z.borderBottomRightRadius)>0;E&&(C=A)}}if(0==k.endOffset&&k.endContainer!==a){var x=k.endContainer.getBoundingClientRect(),F=i.top+d-i.top,z=getComputedStyle(k.endContainer),A=parseFloat(z.borderTopWidth),B=parseFloat(z.paddingTop),y=A+B-F;if(y>0){var G=y;if(y>B){G=B,y-=G;var H=y;H>A?(H=A,y-=H):y=0}else y=0}}for(var I=w.length-1;I>=0;I--)w[I].setAttribute("data-css-continued-fragment",!0),getComputedStyle(w[I]).display.indexOf("block")>=0&&w[I].setAttribute("data-css-continued-block-fragment",!0);"number"==typeof C&&(w[0].removeAttribute("data-css-continued-fragment"),w[0].setAttribute("data-css-special-continued-fragment",!0),w[0].style.borderBottomWidth=A-C+"px"),"number"==typeof D&&(w[0].removeAttribute("data-css-continued-fragment"),w[0].setAttribute("data-css-special-continued-fragment",!0),w[0].style.paddingBottom=B-D+"px"),"number"==typeof H&&(w[0].removeAttribute("data-css-continued-fragment"),w[0].setAttribute("data-css-continued-fragment",!0),w[0].style.borderTopWidth=A-H+"px"),"number"==typeof G&&(w[0].removeAttribute("data-css-continued-fragment"),w[0].setAttribute("data-css-special-continued-fragment",!0),w[0].style.paddingTop=B-G+"px"),k.setEnd(a,a.childNodes.length);var J=k.extractContents(),K=w[0];if(K&&(K=K.lastChild)&&!K.tagName&&K.nodeValue){var L=K.nodeValue.replace(/(\s|\r|\n)*$/,"");L?K.nodeValue=L:K.parentNode.removeChild(K)}for(var M=J.querySelectorAll("[data-css-continued-fragment]"),I=M.length;I--;)M[I].removeAttribute("data-css-continued-fragment"),M[I].setAttribute("data-css-starting-fragment",!0);var N=J.querySelector("[data-css-special-continued-fragment]");if(N)N.removeAttribute("data-css-special-continued-fragment"),N.setAttribute("data-css-starting-fragment",!0),"number"==typeof C&&(N.style.borderBottomWidth=C+"px"),"number"==typeof D?N.style.paddingBottom=D:N.style.paddingBottom="0px","number"==typeof H&&(N.removeAttribute("data-css-starting-fragment"),N.setAttribute("data-css-special-starting-fragment",!0),N.style.borderTopWidth=H+"px"),"number"==typeof G&&(N.removeAttribute("data-css-starting-fragment"),N.setAttribute("data-css-special-starting-fragment",!0),N.style.paddingTop=G+"px",N.style.paddingBottom="0px",N.style.borderBottomWidth="0px");else if("number"==typeof C)try{throw new Error}catch(l){setImmediate(function(){throw l})}else if("number"==typeof G)try{throw new Error}catch(l){setImmediate(function(){throw l})}return g.unembedTrailingWhiteSpaceNodes(a),g.unembedTrailingWhiteSpaceNodes(J),J},enablePolyfill:function(){var b=c.createElement("style");b.setAttribute("data-css-no-polyfill",!0),b.textContent=i;var f=c.head||c.getElementsByTagName("head")[0];f.appendChild(b),e.startMonitoringProperties(["flow-into","flow-from","region-fragment"],{onupdate:function(a,b){if(!a.getAttributeNode("data-css-regions-fragment-of")){cssConsole.dir({message:"onupdate",element:a,selector:b.selector.toCSSString(),rule:b});var c=e.getSpecifiedStyle(a,"flow-into").filter(function(a){return a instanceof d.IdentifierToken}),f=c[0]?c[0].toCSSString().toLowerCase():"";("none"==f||"initial"==f||"inherit"==f||"default"==f)&&(f="");var g=c[1]?c[1].toCSSString().toLowerCase():"";"content"!=g&&(g="element");var c=f?f+" "+g:"",h=e.getSpecifiedStyle(a,"flow-from").filter(function(a){return a instanceof d.IdentifierToken}),i=h[0]?h[0].toCSSString().toLowerCase():"";("none"==i||"initial"==i||"inherit"==i||"default"==i)&&(i="");var h=i;if(a.cssRegionsLastFlowInto!=c||a.cssRegionsLastFlowFrom!=h){var k=a.regionOverset,l=j.flows[a.cssRegionsLastFlowFromName],m=j.flows[a.cssRegionsLastFlowIntoName];if(l&&l.removeFromRegions(a),m&&m.removeFromContent(a),l&&"empty"!=k&&l.relayout(),m&&m.relayout(),a.cssRegionsLastFlowInto=c,a.cssRegionsLastFlowFrom=h,a.cssRegionsLastFlowIntoName=f,a.cssRegionsLastFlowFromName=i,a.cssRegionsLastFlowIntoType=g,i){var l=j.flows[i]=j.flows[i]||new j.Flow(i);l&&l.addToRegions(a),l&&l.relayout()}if(f){var m=j.flows[f]=j.flows[f]||new j.Flow(f);m&&m.addToContent(a),m&&m.relayout()}}}}}),e.startMonitoringProperties(["break-before","break-after"],{onupdate:function(a){if(!a.getAttribute("data-css-regions-fragment-of"))for(;a;){if(a.cssRegionsLastFlowIntoName)return void j.flows[a.cssRegionsLastFlowIntoName].relayout();a=a.parentNode}}}),j.enablePolyfillObjectModel(),a.addEventListener("load",function(){for(var a=c.getNamedFlows(),b=0;b<a.length;b++)a[b].relayout()});var g=0,h=function(){h.timeout=0;for(var a=c.getNamedFlows(),b=0;b<a.length;b++)a[b].lastRelayout>g||(a[b].relayoutInProgress?a[b].relayout():a[b].relayoutIfSizeChanged())},k=function(){for(var a=c.getNamedFlows(),b=0;b<a.length;b++)if(!(a[b].lastRelayout>g)&&a[b].relayoutInProgress)return!0;return!1},l=function(){for(var a=c.getNamedFlows(),b=0;b<a.length;b++)a[b].lastRelayout>g||a[b].relayoutInProgress&&a[b].relayout()};a.addEventListener("resize",function(){g=+new Date,h.timeout||(k()?(setTimeout(l,16),h.timeout=setTimeout(h,500)):h.timeout=setTimeout(h,200))})},flows:Object.create?Object.create(null):{}};return h(a,c,j),j}(window,document),b.define("src/css-regions/polyfill.js"),b("src/css-regions/polyfill.js"),b.define("src/requirements.js"),window.cssPolyfills={require:b}}();
        //# sourceMappingURL=css-regions-polyfill.min.js.map
    </script>

    <script id="application">

        var initRegions = function() {

            var prepareRegions = function(theTextareaContainer, regionContainer) {

                var createRegion = function() {
                    var region = document.createElement('div');

                    region.style.width = '8.5in';
                    region.style.height = '11in';
                    region.classList.add('textarea-region');

                    return region;
                };

                var createFirstRegion = function(regionContainer) {
                    regionContainer.appendChild(createRegion());
                };

                var setupOversetListener = function(regionContainer) {

                    document.getNamedFlow('textarea-content').addEventListener('regionoversetchange', function(e) {

                        if (e.target.overset) {
                            console.log('region added');
                            regionContainer.appendChild(createRegion());
                            return;
                        }

                    });
                };

                var run = function() {
                    createFirstRegion(regionContainer);
                    setupOversetListener(regionContainer);

                    theTextareaContainer.classList.add('textarea-content');
                };

                run();
            };

            var run = function() {
                var regionContainer = document.createElement('div');
                var theTextareaContainer = document.getElementById('the-textarea-container');

                document.body.appendChild(regionContainer);

                prepareRegions(theTextareaContainer, regionContainer);
            };

            run();
        };

        var init = function() {
            autosize(document.querySelectorAll('textarea'));

            var theTextarea = document.getElementById('the-textarea');

            theTextarea.oninput = function(e) {
                e.target.innerHTML = e.target.value;
            };
        };

        init();
    </script>

</body>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants