UNPKG

is-html-attribute-closing

Version:

Is a character on a given index a closing of an HTML attribute?

68 lines (66 loc) 29.6 kB
/** * @name is-html-attribute-closing * @fileoverview Is a character on a given index a closing of an HTML attribute? * @version 4.0.23 * @author Roy Revelt, Codsen Ltd * @license MIT * {@link https://codsen.com/os/is-html-attribute-closing/} */ "use strict";var isHtmlAttributeClosing=(()=>{var fe=Object.create;var Q=Object.defineProperty;var be=Object.getOwnPropertyDescriptor;var ge=Object.getOwnPropertyNames,Z=Object.getOwnPropertySymbols,he=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable;var K=(e,t,o)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,Y=(e,t)=>{for(var o in t||(t={}))ee.call(t,o)&&K(e,o,t[o]);if(Z)for(var o of Z(t))de.call(t,o)&&K(e,o,t[o]);return e};var $e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),pe=(e,t)=>{for(var o in t)Q(e,o,{get:t[o],enumerable:!0})},te=(e,t,o,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ge(t))!ee.call(e,a)&&a!==o&&Q(e,a,{get:()=>t[a],enumerable:!(c=be(t,a))||c.enumerable});return e};var oe=(e,t,o)=>(o=e!=null?fe(he(e)):{},te(t||!e||!e.__esModule?Q(o,"default",{value:e,enumerable:!0}):o,e)),ye=e=>te(Q({},"__esModule",{value:!0}),e);var z=$e((Ye,re)=>{"use strict";re.exports=Ee;function W(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Ee(e){if(e=e||{},e.circles)return we(e);let t=new Map;if(t.set(Date,n=>new Date(n)),t.set(Map,(n,l)=>new Map(c(Array.from(n),l))),t.set(Set,(n,l)=>new Set(c(Array.from(n),l))),e.constructorHandlers)for(let n of e.constructorHandlers)t.set(n[0],n[1]);let o=null;return e.proto?u:a;function c(n,l){let s=Object.keys(n),i=new Array(s.length);for(let g=0;g<s.length;g++){let f=s[g],b=n[f];typeof b!="object"||b===null?i[f]=b:b.constructor!==Object&&(o=t.get(b.constructor))?i[f]=o(b,l):ArrayBuffer.isView(b)?i[f]=W(b):i[f]=l(b)}return i}function a(n){if(typeof n!="object"||n===null)return n;if(Array.isArray(n))return c(n,a);if(n.constructor!==Object&&(o=t.get(n.constructor)))return o(n,a);let l={};for(let s in n){if(Object.hasOwnProperty.call(n,s)===!1)continue;let i=n[s];typeof i!="object"||i===null?l[s]=i:i.constructor!==Object&&(o=t.get(i.constructor))?l[s]=o(i,a):ArrayBuffer.isView(i)?l[s]=W(i):l[s]=a(i)}return l}function u(n){if(typeof n!="object"||n===null)return n;if(Array.isArray(n))return c(n,u);if(n.constructor!==Object&&(o=t.get(n.constructor)))return o(n,u);let l={};for(let s in n){let i=n[s];typeof i!="object"||i===null?l[s]=i:i.constructor!==Object&&(o=t.get(i.constructor))?l[s]=o(i,u):ArrayBuffer.isView(i)?l[s]=W(i):l[s]=u(i)}return l}}function we(e){let t=[],o=[],c=new Map;if(c.set(Date,s=>new Date(s)),c.set(Map,(s,i)=>new Map(u(Array.from(s),i))),c.set(Set,(s,i)=>new Set(u(Array.from(s),i))),e.constructorHandlers)for(let s of e.constructorHandlers)c.set(s[0],s[1]);let a=null;return e.proto?l:n;function u(s,i){let g=Object.keys(s),f=new Array(g.length);for(let b=0;b<g.length;b++){let h=g[b],m=s[h];if(typeof m!="object"||m===null)f[h]=m;else if(m.constructor!==Object&&(a=c.get(m.constructor)))f[h]=a(m,i);else if(ArrayBuffer.isView(m))f[h]=W(m);else{let d=t.indexOf(m);d!==-1?f[h]=o[d]:f[h]=i(m)}}return f}function n(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return u(s,n);if(s.constructor!==Object&&(a=c.get(s.constructor)))return a(s,n);let i={};t.push(s),o.push(i);for(let g in s){if(Object.hasOwnProperty.call(s,g)===!1)continue;let f=s[g];if(typeof f!="object"||f===null)i[g]=f;else if(f.constructor!==Object&&(a=c.get(f.constructor)))i[g]=a(f,n);else if(ArrayBuffer.isView(f))i[g]=W(f);else{let b=t.indexOf(f);b!==-1?i[g]=o[b]:i[g]=n(f)}}return t.pop(),o.pop(),i}function l(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return u(s,l);if(s.constructor!==Object&&(a=c.get(s.constructor)))return a(s,l);let i={};t.push(s),o.push(i);for(let g in s){let f=s[g];if(typeof f!="object"||f===null)i[g]=f;else if(f.constructor!==Object&&(a=c.get(f.constructor)))i[g]=a(f,l);else if(ArrayBuffer.isView(f))i[g]=W(f);else{let b=t.indexOf(f);b!==-1?i[g]=o[b]:i[g]=l(f)}}return t.pop(),o.pop(),i}}});var Se={};pe(Se,{isAttrClosing:()=>Ne,version:()=>Ce});var w=new Set(["abbr","accept","accept-charset","accesskey","action","align","alink","allow","alt","archive","async","autocapitalize","autocomplete","autofocus","autoplay","axis","background","background-attachment","background-color","background-image","background-position","background-position-x","background-position-y","background-repeat","bgcolor","border","border-bottom","border-bottom-color","border-bottom-style","border-bottom-width","border-collapse","border-color","border-left","border-left-color","border-left-style","border-left-width","border-right","border-right-color","border-right-style","border-right-width","border-style","border-top","border-top-color","border-top-style","border-top-width","border-width","buffered","capture","cellpadding","cellspacing","challenge","char","charoff","charset","checked","cite","class","classid","clear","clip","code","codebase","codetype","color","cols","colspan","column-span","compact","content","contenteditable","contextmenu","controls","coords","crossorigin","csp","cursor","data","data-*","datetime","declare","decoding","default","defer","dir","direction","dirname","disabled","display","download","draggable","dropzone","enctype","enterkeyhint","face","filter","float","font","font-color","font-emphasize","font-emphasize-position","font-emphasize-style","font-family","font-size","font-style","font-variant","font-weight","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","frame","frameborder","frontuid","headers","height","hidden","high","horiz-align","href","hreflang","hspace","http-equiv","icon","id","importance","inputmode","integrity","intrinsicsize","ismap","itemprop","keytype","kind","label","lang","language","layout-flow","layout-grid","layout-grid-char","layout-grid-line","layout-grid-mode","layout-grid-type","left","letter-spacing","line-break","line-height","link","list","list-image-1","list-image-2","list-image-3","list-style","list-style-image","list-style-position","list-style-type","loading","longdesc","loop","low","manifest","margin","margin-bottom","margin-left","margin-right","margin-top","marginheight","marginwidth","max","maxlength","media","method","min","minlength","mso-ansi-font-size","mso-ansi-font-style","mso-ansi-font-weight","mso-ansi-language","mso-ascii-font-family","mso-background","mso-background-source","mso-baseline-position","mso-bidi-flag","mso-bidi-font-family","mso-bidi-font-size","mso-bidi-font-style","mso-bidi-font-weight","mso-bidi-language","mso-bookmark","mso-border-alt","mso-border-between","mso-border-between-color","mso-border-between-style","mso-border-between-width","mso-border-bottom-alt","mso-border-bottom-color-alt","mso-border-bottom-source","mso-border-bottom-style-alt","mso-border-bottom-width-alt","mso-border-color-alt","mso-border-effect","mso-border-left-alt","mso-border-left-color-alt","mso-border-left-source","mso-border-left-style-alt","mso-border-left-width-alt","mso-border-right-alt","mso-border-right-color-alt","mso-border-right-source","mso-border-right-style-alt","mso-border-right-width-alt","mso-border-shadow","mso-border-source","mso-border-style-alt","mso-border-top-alt","mso-border-top-color-alt","mso-border-top-source","mso-border-top-style-alt","mso-border-top-width-alt","mso-border-width-alt","mso-break-type","mso-build","mso-build-after-action","mso-build-after-color","mso-build-auto-secs","mso-build-avi","mso-build-dual-id","mso-build-order","mso-build-sound-name","mso-bullet-image","mso-cell-special","mso-cellspacing","mso-char-indent","mso-char-indent-count","mso-char-indent-size","mso-char-type","mso-char-wrap","mso-color-alt","mso-color-index","mso-color-source","mso-column-break-before","mso-column-separator","mso-columns","mso-comment-author","mso-comment-continuation","mso-comment-id","mso-comment-reference","mso-data-placement","mso-default-height","mso-default-width","mso-diagonal-down","mso-diagonal-down-color","mso-diagonal-down-source","mso-diagonal-down-style","mso-diagonal-down-width","mso-diagonal-up","mso-diagonal-up-color","mso-diagonal-up-source","mso-diagonal-up-style","mso-diagonal-up-width","mso-displayed-decimal-separator","mso-displayed-thousand-separator","mso-element","mso-element-anchor-horizontal","mso-element-anchor-lock","mso-element-anchor-vertical","mso-element-frame-height","mso-element-frame-hspace","mso-element-frame-vspace","mso-element-frame-width","mso-element-left","mso-element-linespan","mso-element-top","mso-element-wrap","mso-endnote-continuation-notice","mso-endnote-continuation-notice-id","mso-endnote-continuation-notice-src","mso-endnote-continuation-separator","mso-endnote-continuation-separator-id","mso-endnote-continuation-separator-src","mso-endnote-display","mso-endnote-id","mso-endnote-numbering","mso-endnote-numbering-restart","mso-endnote-numbering-start","mso-endnote-numbering-style","mso-endnote-position","mso-endnote-separator","mso-endnote-separator-id","mso-endnote-separator-src","mso-even-footer","mso-even-footer-id","mso-even-footer-src","mso-even-header","mso-even-header-id","mso-even-header-src","mso-facing-pages","mso-fareast-font-family","mso-fareast-hint","mso-fareast-language","mso-field-change","mso-field-change-author","mso-field-change-time","mso-field-change-value","mso-field-code","mso-field-lock","mso-fills-color","mso-first-footer","mso-first-footer-id","mso-first-footer-src","mso-first-header","mso-first-header-id","mso-first-header-src","mso-font-alt","mso-font-charset","mso-font-format","mso-font-info","mso-font-info-charset","mso-font-info-type","mso-font-kerning","mso-font-pitch","mso-font-signature","mso-font-signature-csb-one","mso-font-signature-csb-two","mso-font-signature-usb-four","mso-font-signature-usb-one","mso-font-signature-usb-three","mso-font-signature-usb-two","mso-font-src","mso-font-width","mso-footer","mso-footer-data","mso-footer-id","mso-footer-margin","mso-footer-src","mso-footnote-continuation-notice","mso-footnote-continuation-notice-id","mso-footnote-continuation-notice-src","mso-footnote-continuation-separator","mso-footnote-continuation-separator-id","mso-footnote-continuation-separator-src","mso-footnote-id","mso-footnote-numbering","mso-footnote-numbering-restart","mso-footnote-numbering-start","mso-footnote-numbering-style","mso-footnote-position","mso-footnote-separator","mso-footnote-separator-id","mso-footnote-separator-src","mso-foreground","mso-forms-protection","mso-generic-font-family","mso-grid-bottom","mso-grid-bottom-count","mso-grid-left","mso-grid-left-count","mso-grid-right","mso-grid-right-count","mso-grid-top","mso-grid-top-count","mso-gutter-direction","mso-gutter-margin","mso-gutter-position","mso-hansi-font-family","mso-header","mso-header-data","mso-header-id","mso-header-margin","mso-header-src","mso-height-alt","mso-height-rule","mso-height-source","mso-hide","mso-highlight","mso-horizontal-page-align","mso-hyphenate","mso-ignore","mso-kinsoku-overflow","mso-layout-grid-align","mso-layout-grid-char-alt","mso-layout-grid-origin","mso-level-inherit","mso-level-legacy","mso-level-legacy-indent","mso-level-legacy-space","mso-level-legal-format","mso-level-number-format","mso-level-number-position","mso-level-numbering","mso-level-reset-level","mso-level-start-at","mso-level-style-link","mso-level-suffix","mso-level-tab-stop","mso-level-text","mso-line-break-override","mso-line-grid","mso-line-height-alt","mso-line-height-rule","mso-line-numbers-count-by","mso-line-numbers-distance","mso-line-numbers-restart","mso-line-numbers-start","mso-line-spacing","mso-linked-frame","mso-list","mso-list-change","mso-list-change-author","mso-list-change-time","mso-list-change-values","mso-list-id","mso-list-ins","mso-list-ins-author","mso-list-ins-time","mso-list-name","mso-list-template-ids","mso-list-type","mso-margin-bottom-alt","mso-margin-left-alt","mso-margin-top-alt","mso-mirror-margins","mso-negative-indent-tab","mso-number-format","mso-outline-level","mso-outline-parent","mso-outline-parent-col","mso-outline-parent-row","mso-outline-parent-visibility","mso-outline-style","mso-padding-alt","mso-padding-between","mso-padding-bottom-alt","mso-padding-left-alt","mso-padding-right-alt","mso-padding-top-alt","mso-page-border-aligned","mso-page-border-art","mso-page-border-bottom-art","mso-page-border-display","mso-page-border-left-art","mso-page-border-offset-from","mso-page-border-right-art","mso-page-border-surround-footer","mso-page-border-surround-header","mso-page-border-top-art","mso-page-border-z-order","mso-page-numbers","mso-page-numbers-chapter-separator","mso-page-numbers-chapter-style","mso-page-numbers-start","mso-page-numbers-style","mso-page-orientation","mso-page-scale","mso-pagination","mso-panose-arm-style","mso-panose-contrast","mso-panose-family-type","mso-panose-letterform","mso-panose-midline","mso-panose-proportion","mso-panose-serif-style","mso-panose-stroke-variation","mso-panose-weight","mso-panose-x-height","mso-paper-source","mso-paper-source-first-page","mso-paper-source-other-pages","mso-pattern","mso-pattern-color","mso-pattern-style","mso-print-area","mso-print-color","mso-print-gridlines","mso-print-headings","mso-print-resolution","mso-print-sheet-order","mso-print-title-column","mso-print-title-row","mso-prop-change","mso-prop-change-author","mso-prop-change-time","mso-protection","mso-rotate","mso-row-margin-left","mso-row-margin-right","mso-ruby-merge","mso-ruby-visibility","mso-scheme-fill-color","mso-scheme-shadow-color","mso-shading","mso-shadow-color","mso-space-above","mso-space-below","mso-spacerun","mso-special-character","mso-special-format","mso-style-id","mso-style-name","mso-style-next","mso-style-parent","mso-style-type","mso-style-update","mso-subdocument","mso-symbol-font-family","mso-tab-count","mso-table-anchor-horizontal","mso-table-anchor-vertical","mso-table-bspace","mso-table-del-author","mso-table-del-time","mso-table-deleted","mso-table-dir","mso-table-ins-author","mso-table-ins-time","mso-table-inserted","mso-table-layout-alt","mso-table-left","mso-table-lspace","mso-table-overlap","mso-table-prop-author","mso-table-prop-change","mso-table-prop-time","mso-table-rspace","mso-table-top","mso-table-tspace","mso-table-wrap","mso-text-animation","mso-text-combine-brackets","mso-text-combine-id","mso-text-control","mso-text-fit-id","mso-text-indent-alt","mso-text-orientation","mso-text-raise","mso-title-page","mso-tny-compress","mso-unsynced","mso-vertical-align-alt","mso-vertical-align-special","mso-vertical-page-align","mso-width-alt","mso-width-source","mso-word-wrap","mso-xlrowspan","mso-zero-height","multiple","muted","name","nav-banner-image","navbutton_background_color","navbutton_home_hovered","navbutton_home_normal","navbutton_home_pushed","navbutton_horiz_hovered","navbutton_horiz_normal","navbutton_horiz_pushed","navbutton_next_hovered","navbutton_next_normal","navbutton_next_pushed","navbutton_prev_hovered","navbutton_prev_normal","navbutton_prev_pushed","navbutton_up_hovered","navbutton_up_normal","navbutton_up_pushed","navbutton_vert_hovered","navbutton_vert_normal","navbutton_vert_pushed","nohref","noresize","noshade","novalidate","nowrap","object","onblur","onchange","onclick","ondblclick","onfocus","onkeydown","onkeypress","onkeyup","onload","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onreset","onselect","onsubmit","onunload","open","optimum","overflow","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","panose-1","pattern","ping","placeholder","position","poster","preload","profile","prompt","punctuation-trim","punctuation-wrap","radiogroup","readonly","referrerpolicy","rel","required","rev","reversed","right","row-span","rows","rowspan","ruby-align","ruby-overhang","ruby-position","rules","sandbox","scheme","scope","scoped","scrolling","selected","separator-image","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","standby","start","step","style","summary","tab-interval","tab-stops","tabindex","table-border-color-dark","table-border-color-light","table-layout","target","text","text-align","text-autospace","text-combine","text-decoration","text-effect","text-fit","text-indent","text-justify","text-justify-trim","text-kashida","text-line-through","text-shadow","text-transform","text-underline","text-underline-color","text-underline-style","title","top","top-bar-button","translate","type","unicode-bidi","urlId","usemap","valign","value","valuetype","version","vert-align","vertical-align","visibility","vlink","vnd.ms-excel.numberformat","vspace","white-space","width","word-break","word-spacing","wrap","xmlns","z-index"]);function D(e){return typeof e=="string"&&(e.charCodeAt(0)>96&&e.charCodeAt(0)<123||e.charCodeAt(0)>64&&e.charCodeAt(0)<91||e.charCodeAt(0)>47&&e.charCodeAt(0)<58||e===":"||e==="-")}var ne=oe(z(),1);var We=(0,ne.default)();function J(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function L(e){return typeof e=="string"}function se(e,t){return J(e)&&L(t)&&t in e}var le=oe(z(),1);var Te=(0,le.default)();var O="\xA0";function ve({str:e,idx:t=0,stopAtNewlines:o=!1,stopAtRawNbsp:c=!1}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),!e[t+1]))return null;if(e[t+1]&&(e[t+1].trim()||o&&` \r`.includes(e[t+1])||c&&e[t+1]===O))return t+1;if(e[t+2]&&(e[t+2].trim()||o&&` \r`.includes(e[t+2])||c&&e[t+2]===O))return t+2;for(let a=t+1,u=e.length;a<u;a++)if(e[a].trim()||o&&` \r`.includes(e[a])||c&&e[a]===O)return a;return null}function P(e,t=0){return ve({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function De({str:e,idx:t,stopAtNewlines:o,stopAtRawNbsp:c}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),t<1))return null;if(e[~-t]&&(e[~-t].trim()||o&&` \r`.includes(e[~-t])||c&&e[~-t]===O))return~-t;if(e[t-2]&&(e[t-2].trim()||o&&` \r`.includes(e[t-2])||c&&e[t-2]===O))return t-2;for(let a=t;a--;)if(e[a]&&(e[a].trim()||o&&` \r`.includes(e[a])||c&&e[a]===O))return a;return null}function B(e,t=0){return De({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function ae(e){return typeof e!="string"?e:e.length?[e]:[]}var ie={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},Ae=e=>e+1;function Re(e,t,o,c,a=!1,u=Ae){var r;let n=typeof o=="function"?o():o;if(+t<0&&a&&n==="EOL")return n;let l=Y(Y({},ie),c);if(t>=e.length&&!a)return!1;let s=a?1:o.length,i=0,g=!1,f=!1,b=!1,h=l.maxMismatches,m=t,d=!1,R=!1,v=!1;function A(){return i===1&&h<l.maxMismatches-1}for(;e[m];){let p=u(m);if(l.trimBeforeMatching&&e[m].trim()===""){if(!e[p]&&a&&o==="EOL")return!0;m=u(m);continue}if(l&&!l.i&&((r=l==null?void 0:l.trimCharsBeforeMatching)!=null&&r.includes(e[m]))||l!=null&&l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.map(V=>V.toLowerCase()).includes(e[m].toLowerCase())){if(a&&o==="EOL"&&!e[p])return!0;m=u(m);continue}let E=p>m?o[o.length-s]:o[s-1];if(!l.i&&e[m]===E||l.i&&e[m].toLowerCase()===E.toLowerCase()){if(d||(d=!0),b||(b=!0),s===o.length){if(R=!0,h!==l.maxMismatches)return!1}else s===1&&(v=!0);if(s-=1,i++,A())return!1;if(!s)return i!==o.length||h===l.maxMismatches||!g?m:!1}else if(!g&&!i&&(g=!0),l.maxMismatches&&h&&m){h-=1;for(let V=0;V<=h;V++){let $=p>m?o[o.length-s+1+V]:o[s-2-V],y=e[u(m)];if($&&(!l.i&&e[m]===$||l.i&&e[m].toLowerCase()===$.toLowerCase())&&(!l.firstMustMatch||s!==o.length)){if(i++,A())return!1;s-=2,d=!0;break}else if(y&&$&&(!l.i&&y===$||l.i&&y.toLowerCase()===$.toLowerCase())&&(!l.firstMustMatch||s!==o.length)){if(!i&&!l.hungry)return!1;s-=1,d=!0;break}else if($===void 0&&h>=0&&d&&(!l.firstMustMatch||R)&&(!l.lastMustMatch||v))return m}d||(f=m)}else return m===0&&s===1&&!l.lastMustMatch&&b?0:!1;if(f!==!1&&f!==m&&(f=!1),s<1)return m;m=u(m)}if(s>0)return a&&n==="EOL"?!0:l&&l.maxMismatches>=s&&b?f||0:!1}function Ve(e,t,o,c,a){var g,f,b;if(J(a)&&se(a,"trimBeforeMatching")&&a&&typeof a.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${e}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(a.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let u=Y(Y({},ie),a);if(typeof u.trimCharsBeforeMatching=="string"&&(u.trimCharsBeforeMatching=ae(u.trimCharsBeforeMatching)),u.trimCharsBeforeMatching=u.trimCharsBeforeMatching.map(h=>L(h)?h:String(h)),!L(t)||!t.length)return!1;if(!Number.isInteger(o)||o<0)throw new Error(`string-match-left-right/${e}(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ${typeof o}, equal to: ${JSON.stringify(o,null,4)}`);let n,l;if(L(c))n=[c];else if(Array.isArray(c))n=c;else if(!c)n=c;else if(typeof c=="function")n=[],n.push(c);else throw new Error(`string-match-left-right/${e}(): [THROW_ID_05] the third argument, whatToMatch, is neither string nor array of strings! It's ${typeof c}, equal to: ${JSON.stringify(c,null,4)}`);if(a&&!J(a))throw new Error(`string-match-left-right/${e}(): [THROW_ID_06] the fourth argument, options object, should be a plain object. Currently it's of a type "${typeof a}", and equal to: ${JSON.stringify(a,null,4)}`);let s=0,i="";if((g=u==null?void 0:u.trimCharsBeforeMatching)!=null&&g.some((h,m)=>h.length>1?(s=m,i=h,!0):!1))throw new Error(`string-match-left-right/${e}(): [THROW_ID_07] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ${s} is longer than 1 character, ${i.length} (equals to ${i}). Please split it into separate characters and put into array as separate elements.`);if(!n||!Array.isArray(n)||Array.isArray(n)&&!n.length||Array.isArray(n)&&n.length===1&&L(n[0])&&!n[0].trim()){if(typeof u.cb=="function"){let m,d=o;if((e==="matchLeftIncl"||e==="matchRight")&&(d+=1),e[5]==="L")for(let r=d;r--;){let p=t[r];if((!u.trimBeforeMatching||u.trimBeforeMatching&&(p!=null&&p.trim()))&&(!((f=u.trimCharsBeforeMatching)!=null&&f.length)||p!==void 0&&!u.trimCharsBeforeMatching.includes(p))){m=r;break}}else if(e.startsWith("matchRight"))for(let r=d;r<t.length;r++){let p=t[r];if((!u.trimBeforeMatching||u.trimBeforeMatching&&p.trim())&&(!((b=u.trimCharsBeforeMatching)!=null&&b.length)||!u.trimCharsBeforeMatching.includes(p))){m=r;break}}if(m===void 0)return!1;let R=t[m],v=m+1,A="";return v&&v>0&&(A=t.slice(0,v)),e[5]==="L"||m&&m>0&&(A=t.slice(m)),u.cb(R,A,m)}let h="";throw a||(h=" More so, the whole options object, the fourth input argument, is missing!"),new Error(`string-match-left-right/${e}(): [THROW_ID_08] the third argument, "whatToMatch", was given as an empty string. This means, you intend to match purely by a callback. The callback was not set though, the opts key "cb" is not set!${h}`)}for(let h=0,m=n.length;h<m;h++){l=typeof n[h]=="function";let d=n[h],R,v,A="",r=o;e==="matchRight"?r+=1:e==="matchLeft"&&(r-=1);let p=Re(t,r,d,u,l,E=>e[5]==="L"?E-1:E+1);if(p&&l&&typeof d=="function"&&d()==="EOL")return d()&&(!u.cb||u.cb(R,A,v))?d():!1;if(Number.isInteger(p)&&(v=e.startsWith("matchLeft")?p-1:p+1,e[5]==="L"?A=t.slice(0,p):A=t.slice(v)),v<0&&(v=void 0),t[v]&&(R=t[v]),Number.isInteger(p)&&(!u.cb||u.cb(R,A,v)))return d}return!1}function q(e,t,o,c){return Ve("matchRight",e,t,o,c)}function I(e){return e==="'"?'"':"'"}function H(e,t,o,c=[]){for(let a=t,u=e.length;a<u;a++){if(c.some(n=>e.startsWith(n,a)))return!0;if(e[a]===o)return!1}return!0}function ue(e,t,o,c){for(let a=t,u=e.length;a<u;a++){if(e.startsWith(o,a))return!0;if(e.startsWith(c,a))return!1}return!1}function X(e,t){return!D(e[t])||!t?!1:/^[a-zA-Z0-9:-]*(\s*[=]?\s*((?:'[^']*')|(?:"[^"]*")))|( [^/>'"=]*['"])/.test(e.slice(t))}function F(e,t){return!t||!D(e[t])?!1:/^[a-zA-Z0-9:-]*=(((?:'[^']*')|(?:"[^"]*"))|((?:['"][^'"]*['"]\s*\/?>)))/.test(e.slice(t))}function G(e,t){if(D(e[B(e,t)])){for(let o=t;o--;)if(e[o].trim().length&&!D(e[o]))return e.slice(o+1,t)}}var me="4.0.23";var Ce=me;function Ne(e,t,o){var A;if(typeof e!="string"||!e.trim()||!Number.isInteger(t)||!Number.isInteger(o)||!e[t]||!e[o]||t>=o)return!1;let c=`'"`.includes(e[t])?e[t]:null,a=null;c&&(a=I(c));let u,n=new Map().set("'",0).set('"',0).set("matchedPairs",0),l=null,s=0,i=!1,g,f,b,h,m=!1,d=!1,R=!1;for(let r=t,p=e.length;r<p;r++){let E=P(e,r),V=B(e,r);if(`'"`.includes(e[r])&&i&&g===t&&f!==void 0&&f<r&&r>=o){let $=r!==o||F(e,P(e,o))||"/>".includes(e[E]),y=!(r>o&&e[t]===e[o]&&e[t]===e[r]&&X(e,r+1)),k=r===o&&X(e,o+1),C=u&&u<r&&w.has(e.slice(u,r).trim()),N;u&&(N=e.slice(u,r).trim());let M=u&&u<r&&e[u-1]&&!e[u-1].trim()&&Array.from(e.slice(u,r).trim()).every(ce=>D(ce))&&e[t]===e[o]&&!"/>".includes(e[E])&&H(e,r+1,"=",["'",'"']),S;r===o&&(S=G(e,r));let _=r===o&&(!D(e[V])||S&&!w.has(S))&&e[V]!=="=",j="/>".includes(e[E])&&r===o,T=D(e[E]),U=i&&r!==o,x=!(r>=o&&e[B(e,o)]===":");return!!($&&y&&(k||C||M||_)&&(j||T||U)&&x)}if(`'"`.includes(e[r])){if(e[r]==="'"&&e[r-1]==='"'&&e[r+1]==='"'||e[r]==='"'&&e[r-1]==="'"&&e[r+1]==="'")continue;l&&e[r]===e[l]?(n.set("matchedPairs",+n.get("matchedPairs")+1),g=l,f=r,l=null,i=!0):i=!1,n.set(e[r],+n.get(e[r])+1),s=+n.get('"')+ +n.get("'")}if(e[r]===">"&&!d&&(d=!0,s&&n.get("matchedPairs")&&s===n.get("matchedPairs")*2&&r<o))return!1;if(e[r]==="<"&&e[E]!=="%"&&d&&!R)return R=!0,!1;if(e[r].trim()&&!u)D(e[r])&&(u=r);else if(u&&!D(e[r])){if(h=b,b=e.slice(u,r),m=u>=o,`'"`.includes(e[r])&&n.get("matchedPairs")===0&&s===3&&e[t]===e[r]&&w.has(b)&&!`'"`.includes(e[E])){let $=r>o,y=!l,k=l+1>=r,C=e.slice(l+1,r).trim().split(/\s+/).every(x=>w.has(x)),N=!b||!(h!=null&&h.endsWith(":")),M=r===o,S=s<3,_=!!i,j=!l,T=l+1>=r,U=!e.slice(l+1,r).trim().split(/\s+/).every(x=>w.has(x));return $&&(y||k||C)&&N||M&&(S||_||j||T||U)}if(b&&w.has(b)&&g===t&&f===o)return!0}if(`'"`.includes(e[r])&&(!(n.get('"')%2)||!(n.get("'")%2))&&(+n.get('"')+ +n.get("'"))%2&&(b&&w.has(b)||r>o+1&&w.has(e.slice(o+1,r).trim()))&&!(e[r+1]===e[r]&&e[r]===e[t])&&!(r>o+1&&e[B(e,o)]===":")&&!(b&&(h!=null&&h.trim().endsWith(":")))){let $=r>o,y=!!c,k=e[t]!==e[o],C=w.has(e.slice(t+1,o).trim()),N=!ue(e,r+1,e[o],I(e[o]));return $&&!(y&&k&&C&&N)}if((e[r]==="="||!e[r].length&&e[E]==="=")&&b&&w.has(b)){let $=r>o,y=!(!(i&&g===t&&f===o||F(e,u))&&i&&g!==void 0&&g<=o);return $&&y}if(r>o){if(c&&e[r]===c){let $=!!l,y=l===o,k=l+1<r&&e.slice(l+1,r).trim(),C=e.slice(l+1,r).trim().split(/\s+/).every(S=>w.has(S)),N=r>=o,M=!e[E]||!`'"`.includes(e[E]);return!!($&&y&&k&&C&&N&&M)}if(c&&e[o]===a&&e[r]===a)return!1;if(e[r]==="/"||e[r]===">"||e[r]==="<"){let $=e[t]===e[o]&&l===o&&!e.slice(t+1,o).includes(e[t]),y=n.get("matchedPairs")<2,k=G(e,r),C=(!k||!w.has(k))&&(!(r>o&&n.get("'")&&n.get('"')&&n.get("matchedPairs")>1)||"/>".includes(e[E])),N=s<3||+n.get('"')+ +n.get("'")-n.get("matchedPairs")*2!==2,M=!i||i&&!(g!==void 0&&Array.from(e.slice(t+1,g).trim()).every(T=>D(T))&&w.has(e.slice(t+1,g).trim())),S=!E&&s%2===0,_=e[t-2]&&e[t-1]==="="&&D(e[t-2]),j=!H(e,r+1,"<",["='",'="']);return $||(y||C)&&N&&(M||S||_||j)}if(e[r]==="="&&q(e,r,["'",'"'],{trimBeforeMatching:!0,trimCharsBeforeMatching:["="]}))return!0}else{let $;if((A=e[r-1])!=null&&A.trim()&&e[r-1]!=="=")$=r-1;else for(let y=r;y--;)if(e[y].trim()&&e[y]!=="="){$=y;break}if(e[r]==="="&&q(e,r,["'",'"'],{cb:y=>!"/>".includes(y),trimBeforeMatching:!0,trimCharsBeforeMatching:["="]})&&D(e[$])&&!e.slice(t+1).startsWith("http")&&!e.slice(t+1,r).includes("/")&&!e.endsWith("src=",t)&&!e.endsWith("href=",t))return!1;if(r===o&&F(e,r+1))return!0;if(r<o&&`'"`.includes(e[r])&&b&&e[B(e,t)]&&e[B(e,t)]!=="="&&g===t&&w.has(b))return!1;if(r===o&&`'"`.includes(e[r])&&(e[V]==="'"||e[V]==='"')&&b&&h&&s%2===0&&h.endsWith(":")||r===o&&`'"`.includes(e[r])&&e.slice(t,o).includes(":")&&(e[E]===">"||e[E]==="/"&&e[P(e,E)]===">"))return!0}if(`'"`.includes(e[r])&&r>o)return!(!m||!b||!w.has(b));`'"`.includes(e[r])&&(l=r),u&&!D(e[r])&&(u=null)}return!1}return ye(Se);})(); /** * @name html-all-known-attributes * @fileoverview All HTML attributes known to the Humanity * @version 6.0.9 * @author Roy Revelt, Codsen Ltd * @license MIT * {@link https://codsen.com/os/html-all-known-attributes/} */ /** * @name is-char-suitable-for-html-attr-name * @fileoverview Is given character suitable to be in an HTML attribute's name? * @version 4.0.9 * @author Roy Revelt, Codsen Ltd * @license MIT * {@link https://codsen.com/os/is-char-suitable-for-html-attr-name/} */ /** * @name codsen-utils * @fileoverview Various utility functions * @version 1.6.8 * @author Roy Revelt, Codsen Ltd * @license MIT * {@link https://codsen.com/os/codsen-utils/} */ /** * @name string-left-right * @fileoverview Looks up the first non-whitespace character to the left/right of a given index * @version 6.0.21 * @author Roy Revelt, Codsen Ltd * @license MIT * {@link https://codsen.com/os/string-left-right/} */ /** * @name arrayiffy-if-string * @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else. * @version 5.0.10 * @author Roy Revelt, Codsen Ltd * @license MIT * {@link https://codsen.com/os/arrayiffy-if-string/} */ /** * @name string-match-left-right * @fileoverview Match substrings on the left or right of a given index, ignoring whitespace * @version 9.0.23 * @author Roy Revelt, Codsen Ltd * @license MIT * {@link https://codsen.com/os/string-match-left-right/} */