Current Path : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/ui/bbcode/model/dist/ |
Current File : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/ui/bbcode/model/dist/model.bundle.min.js |
this.BX=this.BX||{};this.BX.UI=this.BX.UI||{};(function(e,t,n){"use strict";function i(e,t){if(!n.Type.isArray(e)){throw new TypeError("array is not a array")}if(!n.Type.isInteger(t)){throw new TypeError("index is not a integer")}const i=t<0?e.length+t:t;return e[i]}const r=new WeakMap;const s=Symbol("name");class o{constructor(e={}){this[s]="#unknown";this.children=[];r.set(this,{delayedChildren:[]});this.setName(e.name);r.get(this).scheme=e.scheme;this.setParent(e.parent);this.setChildren(e.children)}static get ELEMENT_NODE(){return 1}static get TEXT_NODE(){return 2}static get ROOT_NODE(){return 3}static get FRAGMENT_NODE(){return 4}static freezeProperty(e,t,n,i=true){Object.defineProperty(e,t,{value:n,writable:false,configurable:false,enumerable:i})}static makeNonEnumerableProperty(e,t){Object.defineProperty(e,t,{writable:false,enumerable:false,configurable:false})}static flattenChildren(e){if(n.Type.isArrayFilled(e)){return e.flatMap((e=>{if(e.getType()===o.FRAGMENT_NODE){return e.getChildren()}return e}))}return[]}setScheme(e,t){r.get(this).scheme=e}getScheme(){return r.get(this).scheme}getTagScheme(){return this.getScheme().getTagScheme(this.getName())}getEncoder(){return this.getScheme().getEncoder()}prepareCase(e){const t=this.getScheme();const n=t.getOutputTagCase();if(n==="upper"){return e.toUpperCase()}return e.toLowerCase()}setName(e){if(n.Type.isString(e)){this[s]=e.toLowerCase()}}getName(){return this[s]}getDisplayedName(){return this.prepareCase(this.getName())}setParent(e=null){const t=!this.hasParent()&&e;r.get(this).parent=e;if(t){this.onNodeDidMount()}}getParent(){return r.get(this).parent}getType(){return r.get(this).type}hasParent(){return Boolean(r.get(this).parent)}remove(){if(this.hasParent()){this.getParent().removeChild(this)}}setChildren(e){if(n.Type.isArray(e)){this.children=[];this.appendChild(...e)}}getChildren(){return[...this.children]}getLastChild(){return i(this.getChildren(),-1)}getLastChildOfType(e){return this.getChildren().reverse().find((t=>t.getType()===e))}getLastChildOfName(e){return this.getChildren().reverse().find((t=>t.getType()===o.ELEMENT_NODE&&t.getName()===e))}getFirstChild(){return i(this.getChildren(),0)}getFirstChildOfType(e){return this.getChildren().find((t=>t.getType()===e))}getFirstChildOfName(e){return this.getChildren().find((t=>t.getType()===o.ELEMENT_NODE&&t.getName()===e))}getPreviewsSibling(){if(this.hasParent()){const e=this.getParent().getChildren();const t=e.indexOf(this);if(t>0){return i(e,t-1)}}return null}getPreviewsSiblings(){if(this.hasParent()){const e=this.getParent().getChildren();const t=e.indexOf(this);return e.filter(((e,n)=>n<t))}return null}getNextSibling(){if(this.hasParent()){const e=this.getParent().getChildren();const t=e.indexOf(this);if(t!==-1&&t!==e.length){return i(e,t+1)}}return null}getNextSiblings(){if(this.hasParent()){const e=this.getParent().getChildren();const t=e.indexOf(this);return e.filter(((e,n)=>n>t))}return null}getChildrenCount(){return this.children.length}hasChildren(){return this.getChildrenCount()>0}isEmpty(){return this.getChildrenCount()===0}adjustChildren(){this.setChildren(this.getChildren())}setDelayedChildren(e){if(n.Type.isArray(e)){r.get(this).delayedChildren=e}}addDelayedChildren(e){if(n.Type.isArrayFilled(e)){this.setDelayedChildren([...this.getDelayedChildren(),...e])}}hasDelayedChildren(){return r.get(this).delayedChildren.length>0}getDelayedChildren(){return[...r.get(this).delayedChildren]}appendChild(...e){const t=o.flattenChildren(e);t.forEach((e=>{e.remove();e.setParent(this);this.children.push(e)}))}prependChild(...e){const t=o.flattenChildren(e);t.forEach((e=>{e.remove();e.setParent(this);this.children.unshift(e)}))}insertBefore(...e){if(this.hasParent()&&n.Type.isArrayFilled(e)){const t=this.getParent();const n=t.getChildren();const i=n.indexOf(this);const r=0;n.splice(i,r,...e);t.setChildren(n)}}insertAfter(...e){if(this.hasParent()&&n.Type.isArrayFilled(e)){const t=this.getParent();const n=t.getChildren();const i=n.indexOf(this);const r=i+1;const s=0;n.splice(r,s,...e);t.setChildren(n)}}propagateChild(...e){if(this.hasParent()){this.insertBefore(...e.filter((e=>!["#linebreak","#tab"].includes(e.getName()))))}else{this.addDelayedChildren(e)}}onNodeDidMount(){const e=this.getDelayedChildren();if(n.Type.isArrayFilled(e)){this.propagateChild(...e);this.setDelayedChildren([])}}removeChild(...e){this.children=this.children.reduce(((t,n)=>{if(e.includes(n)){n.setParent(null);return t}return[...t,n]}),[])}replaceChild(e,...t){this.children=this.children.flatMap((n=>{if(n===e){n.setParent(null);const e=o.flattenChildren(t);return e.map((e=>{e.remove();e.setParent(this);return e}))}return n}))}replace(...e){if(this.hasParent()){const t=this.getParent();t.replaceChild(this,...e)}}clone(e={}){const t=(()=>{if(e.deep){return this.getChildren().map((t=>t.clone(e)))}return[]})();return this.getScheme().createNode({name:this.getName(),parent:this.getParent(),children:t})}toPlainText(){return this.getChildren().map((e=>e.toPlainText())).join("")}getTextContent(){return this.toPlainText()}getPlainTextLength(){return this.toPlainText().length}removePreviewsSiblings(){const e=t=>{const i=t.getPreviewsSiblings();if(n.Type.isArray(i)){i.forEach((e=>{e.remove()}))}const r=t.getParent();if(r){e(r)}};e(this)}removeNextSiblings(){const e=t=>{const i=t.getNextSiblings();if(n.Type.isArray(i)){i.forEach((e=>{e.remove()}))}const r=t.getParent();if(r){e(r)}};e(this)}findByTextIndex(e){let t=0;let n=0;let i=0;const r=o.flattenAst(this).find((r=>{if(r.getName()==="#text"||r.getName()==="#linebreak"||r.getName()==="#tab"){n=t;i=n+r.getLength();t=i;return e>=n&&i>=e}return false}));if(r){return{node:r,startIndex:n,endIndex:i}}return null}split(e){const{offset:t,byWord:n=false}=e;const i=this.getPlainTextLength();const r=(()=>{if(i===t){return this.clone({deep:true})}if(t<=0||t>i){return null}const e=this.clone({deep:true});const{node:r,startIndex:s}=e.findByTextIndex(t);const[o,l]=r.split({offset:t-s,byWord:n});if(o){r.replace(o);o.removeNextSiblings()}else if(l){l.removeNextSiblings();l.remove()}return e})();const s=(()=>{if(i===t){return null}if(t===0){return this.clone({deep:true})}const e=this.clone({deep:true});const{node:r,startIndex:s}=e.findByTextIndex(t);const[o,l]=r.split({offset:t-s,byWord:n});if(l){r.replace(l);l.removePreviewsSiblings()}else if(o){o.removePreviewsSiblings();if(o.hasParent()){const e=o.getParent();o.remove();if(e.getChildrenCount()===0){e.remove()}}}return e})();return[r,s]}static flattenAst(e){const t=[];const n=e=>{t.push(e);if(e.hasChildren()){e.getChildren().forEach((e=>{n(e)}))}};if(e.hasChildren()){e.getChildren().forEach((e=>{n(e)}))}return t}toJSON(){return{name:this.getName(),children:this.getChildren().map((e=>e.toJSON()))}}}const l=Symbol("void");class a extends o{constructor(e={}){super(e);this.attributes={};this.value="";this[l]=false;r.get(this).type=o.ELEMENT_NODE;const t=this.getTagScheme();this[l]=t.isVoid();this.setValue(e.value);this.setAttributes(e.attributes)}setScheme(e,t){this.getChildren().forEach((n=>{n.setScheme(e,t)}));if(e.isAllowedTag(this.getName())){super.setScheme(e);const t=this.getTagScheme();this[l]=t.isVoid()}else{super.setScheme(e);t(this,e)}}filterChildren(e){const t={resolved:[],unresolved:[]};const n=this.getScheme();e.forEach((e=>{if(n.isChildAllowed(this,e)){t.resolved.push(e)}else{t.unresolved.push(e)}}));return t}convertChildren(e){const t=this.getTagScheme();const n=t.getChildConverter();if(n){const t=this.getScheme();return e.map((e=>n(e,t)))}return e}setValue(e){if(n.Type.isString(e)||n.Type.isNumber(e)||n.Type.isBoolean(e)){this.value=e}}getValue(){return this.value}isVoid(){return this[l]}canBeEmpty(){return this.getTagScheme().canBeEmpty()}hasGroup(e){return this.getTagScheme().hasGroup(e)}setAttributes(e){if(n.Type.isPlainObject(e)){const t=Object.entries(e).map((([e,t])=>[e.toLowerCase(),t]));this.attributes=Object.fromEntries(t)}}setAttribute(e,t){if(n.Type.isStringFilled(e)){const i=e.toLowerCase();if(n.Type.isNil(t)){delete this.attributes[i]}else{this.attributes[i]=t}}}getAttribute(e){if(n.Type.isString(e)){return this.attributes[e.toLowerCase()]}return null}getAttributes(){return{...this.attributes}}appendChild(...e){const t=o.flattenChildren(e);const i=this.filterChildren(t);const r=this.convertChildren(i.resolved);r.forEach((e=>{e.remove();e.setParent(this);this.children.push(e)}));if(n.Type.isArrayFilled(i.unresolved)){if(this.getScheme().isAllowedUnresolvedNodesHoisting()){this.propagateChild(...i.unresolved)}else{i.unresolved.forEach((e=>{e.remove()}))}}}prependChild(...e){const t=o.flattenChildren(e);const i=this.filterChildren(t);const r=this.convertChildren(i.resolved);r.forEach((e=>{e.remove();e.setParent(this);this.children.unshift(e)}));if(n.Type.isArrayFilled(i.unresolved)){if(this.getScheme().isAllowedUnresolvedNodesHoisting()){this.propagateChild(...i.unresolved)}else{i.unresolved.forEach((e=>{e.remove()}))}}}replaceChild(e,...t){this.children=this.children.flatMap((n=>{if(n===e){n.setParent(null);const e=o.flattenChildren(t);const i=this.filterChildren(e);const r=this.convertChildren(i.resolved);return r.map((e=>{e.remove();e.setParent(this);return e}))}return n}))}toStringValue(){const e=this.getValue();const t=this.getEncoder().encodeAttribute(e);return e?`=${t}`:""}toStringAttributes(){return Object.entries(this.getAttributes()).map((([e,t])=>{const n=this.prepareCase(e);const i=this.getEncoder().encodeAttribute(t);return t?`${n}=${i}`:n})).join(" ")}getContent(){return this.getChildren().map((e=>e.toString())).join("")}getOpeningTag(){const e=this.getDisplayedName();const t=this.toStringValue();const i=this.toStringAttributes();const r=n.Type.isStringFilled(i)?` ${i}`:"";return`[${e}${t}${r}]`}getClosingTag(){return`[/${this.getDisplayedName()}]`}clone(e={}){const t=(()=>{if(e.deep){return this.getChildren().map((t=>t.clone(e)))}return[]})();return this.getScheme().createElement({name:this.getName(),void:this.isVoid(),value:this.getValue(),attributes:{...this.getAttributes()},children:t})}splitByChildIndex(e){if(!n.Type.isNumber(e)){throw new TypeError("index is not a number")}const t=this.getChildrenCount();if(e<0||e>t){throw new TypeError(`index '${e}' is out of range ${0}-${t}`)}const i=(()=>{if(e===t){return this}if(e===0){return null}const n=this.getChildren().filter(((t,n)=>n<e));const i=this.clone();i.setChildren(n);return i})();const r=(()=>{if(e===0){return this}if(e===t){return null}const n=this.getChildren();const i=this.clone();i.setChildren(n);return i})();if(i&&r){this.replace(i,r)}return[i,r]}getTagScheme(){return super.getTagScheme()}toString(){const e=this.getTagScheme();const t=e.getStringifier();if(n.Type.isFunction(t)){const e=this.getScheme();return t(this,e)}const i=this.getOpeningTag();const r=this.getContent();if(this.isVoid()){return`${i}${r}`}const s=this.getClosingTag();return`${i}${r}${s}`}toJSON(){return{...super.toJSON(),value:this.getValue(),attributes:this.getAttributes(),void:this.isVoid()}}}class h extends a{constructor(e){super({...e,name:"#root"});r.get(this).type=o.ROOT_NODE;h.makeNonEnumerableProperty(this,"value");h.makeNonEnumerableProperty(this,"attributes");h.freezeProperty(this,s,"#root")}setScheme(e,t){o.flattenAst(this).forEach((n=>{n.setScheme(e,t)}));super.setScheme(e);o.flattenAst(this).forEach((e=>{e.adjustChildren()}))}getParent(){return null}clone(e={}){const t=(()=>{if(e.deep){return this.getChildren().map((t=>t.clone(e)))}return[]})();return this.getScheme().createRoot({children:t})}toString(){return this.getChildren().map((e=>e.toString())).join("")}toJSON(){return this.getChildren().map((e=>e.toJSON()))}}class d extends a{constructor(e){super({...e,name:"#fragment"});r.get(this).type=o.FRAGMENT_NODE;d.makeNonEnumerableProperty(this,"value");d.makeNonEnumerableProperty(this,"attributes");d.freezeProperty(this,s,"#fragment")}clone(e={}){const t=(()=>{if(e.deep){return this.getChildren().map((t=>t.clone(e)))}return[]})();return this.getScheme().createFragment({children:t})}}const c=Symbol("content");class g extends o{constructor(e={}){const t=n.Type.isString(e)?{content:e}:e;super(t);this[s]="#text";this[c]="";r.get(this).type=o.TEXT_NODE;this.setContent(t.content);o.makeNonEnumerableProperty(this,"children")}static isTextNodeContent(e){return n.Type.isString(e)||n.Type.isNumber(e)}setName(e){}setContent(e){if(g.isTextNodeContent(e)){this[c]=e}}getContent(){return this[c]}adjustChildren(){}getLength(){return String(this[c]).length}isEmpty(){return this.getLength()===0}clone(e){return this.getScheme().createText({content:this.getContent()})}split(e){const{offset:t,byWord:i=false}=e;if(!n.Type.isNumber(t)){throw new TypeError("offset is not a number")}const r=this.getLength();if(t<0||t>r){throw new TypeError(`offset '${t}' is out of range ${0}-${r}`)}const s=this.getContent();const o=(()=>{if(i&&t!==r){const e=s.lastIndexOf(" ",t);if(e!==-1){if(t>e){return e+1}return e}return 0}return t})();const l=(()=>{if(o===r){return this}if(o===0){return null}const e=this.clone();e.setContent(s.slice(0,o));return e})();const a=(()=>{if(o===0){return this}if(o===r){return null}const e=this.clone();e.setContent(s.slice(o,r));return e})();return[l,a]}toString(){return this.getEncoder().encodeText(this.getContent())}toPlainText(){return this.toString()}toJSON(){return{name:this.getName(),content:this.toString()}}}class u extends g{constructor(e={}){super(e);this[s]="#linebreak";this[c]="\n"}setContent(e){}clone(e){return this.getScheme().createNewLine()}}class p extends g{constructor(e={}){super(e);this[s]="#tab";this[c]="\t"}setContent(e){}clone(e){return this.getScheme().createTab()}}class m{constructor(e){this.name=[];this.group=[];this.stringifier=null;this.serializer=null;this.allowedIn=[];if(!n.Type.isPlainObject(e)){throw new TypeError("options is not a object")}if(!n.Type.isArrayFilled(this.name)&&!n.Type.isArrayFilled(e.name)&&!n.Type.isStringFilled(e.name)){throw new TypeError("options.name is not specified")}this.setGroup(e.group);this.setName(e.name);this.setAllowedIn(e.allowedIn);this.setStringifier(e.stringify);this.setSerializer(e.serialize)}setName(e){if(n.Type.isStringFilled(e)){this.name=[e]}if(n.Type.isArrayFilled(e)){this.name=e}}getName(){return[...this.name]}removeName(...e){this.setName(this.getName().filter((t=>!e.includes(t))))}setGroup(e){if(n.Type.isStringFilled(e)){this.group=[e]}if(n.Type.isArrayFilled(e)){this.group=e}}removeGroup(...e){this.setGroup(this.getGroup().filter((t=>!e.includes(t))))}getGroup(){return[...this.group]}hasGroup(e){return this.getGroup().includes(e)}setStringifier(e){if(n.Type.isFunction(e)||n.Type.isNull(e)){this.stringifier=e}}getStringifier(){return this.stringifier}setSerializer(e){if(n.Type.isFunction(e)||n.Type.isNull(e)){this.serializer=e}}getSerializer(){return this.serializer}setAllowedIn(e){if(n.Type.isArray(e)){this.allowedIn=[...e]}}getAllowedIn(){return[...this.allowedIn]}isAllowedIn(e){const t=this.getAllowedIn();return!n.Type.isArrayFilled(t)||n.Type.isArrayFilled(t)&&t.includes(e)}}const f=Symbol("@canBeEmpty");const C=Symbol("@void");class T extends m{constructor(e){super(e);this[C]=false;this[f]=true;this.childConverter=null;this.allowedChildren=[];this.setVoid(e.void);this.setCanBeEmpty(e.canBeEmpty);this.setChildConverter(e.convertChild);this.setAllowedChildren(e.allowedChildren)}static defaultBlockStringifier(e){const t=(()=>{const t=e.getPreviewsSibling();return t&&t.getName()!=="#linebreak"})();const n=(()=>{const t=e.getFirstChild();return t&&t.getName()!=="#linebreak"})();const i=(()=>{const t=e.getLastChild();return t&&t.getName()!=="#linebreak"})();const r=(()=>{const t=e.getNextSibling();return t&&t.getName()!=="#linebreak"&&!(t.getType()===o.ELEMENT_NODE&&!t.getTagScheme().getGroup().includes("#inline"))})();const s=e.getOpeningTag();const l=e.getContent();const a=e.getClosingTag();return[t?"\n":"",s,n?"\n":"",l,i?"\n":"",a,r?"\n":""].join("")}setName(e){super.setName(e)}setVoid(e){if(n.Type.isBoolean(e)){this[C]=e}}isVoid(){return this[C]}setCanBeEmpty(e){if(n.Type.isBoolean(e)){this[f]=e}}canBeEmpty(){return this[f]}setChildConverter(e){if(n.Type.isFunction(e)||n.Type.isNull(e)){this.childConverter=e}}getChildConverter(){return this.childConverter}setAllowedChildren(e){if(n.Type.isArray(e)){this.allowedChildren=e}}getAllowedChildren(){return this.allowedChildren}isChildAllowed(e){const t=this.getAllowedChildren();return!n.Type.isArrayFilled(t)||n.Type.isArrayFilled(t)&&t.includes(e)}}class y{static isNodeScheme(e){return e instanceof m}static getTagName(e){if(n.Type.isString(e)){return e}if(n.Type.isObject(e)&&e instanceof o){return e.getName()}return null}constructor(e={}){this.tagSchemes=[];this.outputTagCase=y.Case.LOWER;this.unresolvedNodesHoisting=true;this.encoder=new t.BBCodeEncoder;if(!n.Type.isPlainObject(e)){throw new TypeError("options is not a object")}this.setTagSchemes(e.tagSchemes);this.setOutputTagCase(e.outputTagCase);this.setUnresolvedNodesHoisting(e.unresolvedNodesHoisting);this.setEncoder(e.encoder)}setTagSchemes(e){if(n.Type.isArray(e)){const t=e.findIndex((e=>!y.isNodeScheme(e)));if(t>-1){throw new TypeError(`tagScheme #${t} is not TagScheme instance`)}this.tagSchemes=[...e]}}setTagScheme(...e){const t=e.findIndex((e=>!y.isNodeScheme(e)));if(t>-1){throw new TypeError(`tagScheme #${t} is not TagScheme instance`)}const i=e.flatMap((e=>e.getName()));const r=this.getTagSchemes();r.forEach((e=>{e.removeName(...i)}));const s=r.filter((e=>n.Type.isArrayFilled(e.getName())));this.setTagSchemes([...s,...e])}getTagSchemes(){return[...this.tagSchemes]}getTagScheme(e){const t=y.getTagName(e);if(n.Type.isString(t)){return this.getTagSchemes().find((e=>e.getName().includes(t.toLowerCase())))}return null}setOutputTagCase(e){if(!n.Type.isNil(e)){const t=Object.values(y.Case);if(t.includes(e)){this.outputTagCase=e}else{throw new TypeError(`'${e}' is not allowed`)}}}getOutputTagCase(){return this.outputTagCase}setUnresolvedNodesHoisting(e){if(!n.Type.isNil(e)){if(n.Type.isBoolean(e)){this.unresolvedNodesHoisting=e}else{throw new TypeError(`'${e}' is not allowed value`)}}}isAllowedUnresolvedNodesHoisting(){return this.unresolvedNodesHoisting}setEncoder(e){if(e instanceof t.BBCodeEncoder){this.encoder=e}}getEncoder(){return this.encoder}getAllowedTags(){return this.getTagSchemes().flatMap((e=>e.getName()))}isAllowedTag(e){const t=this.getAllowedTags();const n=y.getTagName(e);return t.includes(String(n).toLowerCase())}isVoid(e){const t=this.getTagScheme(e);if(t){return t.isVoid()}return false}isElement(e){return e&&e.getType()===o.ELEMENT_NODE}isRoot(e){return e&&e.getName()==="#root"}isFragment(e){return e&&e.getName()==="#fragment"}isAnyText(e){return e&&e.getType()===o.TEXT_NODE}isText(e){return e&&e.getName()==="#text"}isNewLine(e){return e&&e.getName()==="#linebreak"}isTab(e){return e&&e.getName()==="#tab"}getParentChildMap(){const e=this.getTagSchemes();const t=new Map;e.forEach((e=>{const n=e.getGroup();const i=[...e.getName(),...n,...e.isVoid()?["#void"]:[]];const r=e.getAllowedChildren();const s=e.getAllowedIn();i.forEach((i=>{if(!t.has(i)){t.set(i,{allowedChildren:new Set,allowedIn:new Set,aliases:new Set})}const o=t.get(i);const l={allowedChildren:new Set([...o.allowedChildren,...r]),allowedIn:new Set([...o.allowedIn,...s]),aliases:new Set([i,...n,...e.isVoid()?["#void"]:[]])};t.set(i,l)}))}));return t}isChildAllowed(e,t){const i=y.getTagName(e);const r=y.getTagName(t);if(n.Type.isStringFilled(i)&&n.Type.isStringFilled(r)){if(i==="#fragment"){return true}const e=this.getParentChildMap();const t=e.get(i);const s=e.get(r);if(n.Type.isPlainObject(t)&&n.Type.isPlainObject(s)){return(t.allowedChildren.size===0||[...s.aliases].some((e=>t.allowedChildren.has(e))))&&(s.allowedIn.size===0||[...t.aliases].some((e=>s.allowedIn.has(e))))}}return false}createRoot(e={}){return new h({...e,scheme:this})}createNode(e){if(!n.Type.isPlainObject(e)){throw new TypeError("options is not a object")}if(!n.Type.isStringFilled(e.name)){throw new TypeError("options.name is required")}if(!this.isAllowedTag(e.name)){throw new TypeError(`Scheme for "${e.name}" tag is not specified.`)}return new o({...e,scheme:this})}createElement(e={}){if(!n.Type.isPlainObject(e)){throw new TypeError("options is not a object")}if(!n.Type.isStringFilled(e.name)){throw new TypeError("options.name is required")}if(!this.isAllowedTag(e.name)){throw new TypeError(`Scheme for "${e.name}" tag is not specified.`)}return new a({...e,scheme:this})}createText(e={}){const t=n.Type.isPlainObject(e)?e:{content:e};return new g({...t,scheme:this})}createNewLine(e={}){const t=n.Type.isPlainObject(e)?e:{content:e};return new u({...t,scheme:this})}createTab(e={}){const t=n.Type.isPlainObject(e)?e:{content:e};return new p({...t,scheme:this})}createFragment(e={}){return new d({...e,scheme:this})}}y.Case={LOWER:"lower",UPPER:"upper"};class w extends m{constructor(e){super({...e,name:["#text"]})}}class S extends m{constructor(e={}){super({...e,name:["#linebreak"]})}}class N extends m{constructor(e){super({...e,name:["#tab"]})}}class b extends y{constructor(e={}){const t=[new T({name:["b","u","i","s"],group:["#inline","#format"],allowedChildren:["#text","#linebreak","#inline"],canBeEmpty:false}),new T({name:["span"],group:["#inline"],allowedChildren:["#text","#linebreak","#inline"],canBeEmpty:false}),new T({name:["img"],group:["#inlineBlock"],allowedChildren:["#text"],canBeEmpty:false}),new T({name:["url"],group:["#inline"],allowedChildren:["#text","#format","img"],canBeEmpty:false}),new T({name:"p",group:["#block"],allowedChildren:["#text","#linebreak","#inline","#inlineBlock"],stringify:T.defaultBlockStringifier,allowedIn:["#root","#shadowRoot"]}),new T({name:"list",group:["#block"],allowedChildren:["*"],stringify:T.defaultBlockStringifier,allowedIn:["#root","#shadowRoot"],canBeEmpty:false}),new T({name:["*"],allowedChildren:["#text","#linebreak","#inline","#inlineBlock"],stringify:e=>{const t=e.getOpeningTag();const n=e.getContent().trim();return`${t}${n}`},allowedIn:["list"]}),new T({name:"table",group:["#block"],allowedChildren:["tr"],stringify:T.defaultBlockStringifier,allowedIn:["#root","quote","spoiler"],canBeEmpty:false}),new T({name:"tr",allowedChildren:["th","td"],allowedIn:["table"],canBeEmpty:false}),new T({name:["th","td"],group:["#shadowRoot"],allowedChildren:["#text","#linebreak","#inline","#inlineBlock","#block"],allowedIn:["tr"]}),new T({name:"quote",group:["#block","#shadowRoot"],allowedChildren:["#text","#linebreak","#inline","#inlineBlock","#block"],allowedIn:["#root","#shadowRoot"]}),new T({name:"code",group:["#block"],stringify:T.defaultBlockStringifier,allowedChildren:["#text","#linebreak","#tab"],allowedIn:["#root","#shadowRoot"]}),new T({name:"video",group:["#inlineBlock"],allowedChildren:["#text"],allowedIn:["#root","#shadowRoot","p"],canBeEmpty:false}),new T({name:"spoiler",group:["#block","#shadowRoot"],allowedChildren:["#text","#linebreak","#inline","#inlineBlock","#block"],allowedIn:["#root","#shadowRoot"]}),new T({name:["user","project","department"],group:["#inline","#mention"],allowedChildren:["#text","#format"],canBeEmpty:false}),new T({name:["#root"]}),new T({name:["#fragment"]}),new T({name:["#text"]}),new T({name:["#linebreak"]}),new T({name:["#tab"],stringify:()=>""})];if((e==null?void 0:e.fileTag)!=="none"){t.push(new T({name:(e==null?void 0:e.fileTag)==="file"?"file":"disk",group:["#inline"],void:true}))}super({tagSchemes:t,outputTagCase:y.Case.LOWER,unresolvedNodesHoisting:true});if(n.Type.isPlainObject(e)){this.setTagSchemes(e.tagSchemes);this.setOutputTagCase(e.outputTagCase);this.setUnresolvedNodesHoisting(e.unresolvedNodesHoisting)}}}e.BBCodeNode=o;e.BBCodeRootNode=h;e.BBCodeElementNode=a;e.BBCodeFragmentNode=d;e.BBCodeNewLineNode=u;e.BBCodeTabNode=p;e.BBCodeTextNode=g;e.BBCodeScheme=y;e.BBCodeTagScheme=T;e.BBCodeTextScheme=w;e.BBCodeNewLineScheme=S;e.BBCodeTabScheme=N;e.DefaultBBCodeScheme=b})(this.BX.UI.BBCode=this.BX.UI.BBCode||{},BX.UI.BBCode,BX); //# sourceMappingURL=model.bundle.map.js