UNPKG

@forbespro/lead-agent

Version:
4 lines (3 loc) 1.13 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function m(l,e,s){const i=l.all(e),a=s?d(s):o(e),h={},p=[];if(typeof e.checked=="boolean"){const t=i[0];let n;t&&t.type==="element"&&t.tagName==="p"?n=t:(n={type:"element",tagName:"p",properties:{},children:[]},i.unshift(n)),n.children.length>0&&n.children.unshift({type:"text",value:" "}),n.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),h.className=["task-list-item"]}let c=-1;for(;++c<i.length;){const t=i[c];(a||c!==0||t.type!=="element"||t.tagName!=="p")&&p.push({type:"text",value:` `}),t.type==="element"&&t.tagName==="p"&&!a?p.push(...t.children):p.push(t)}const r=i[i.length-1];r&&(a||r.type!=="element"||r.tagName!=="p")&&p.push({type:"text",value:` `});const u={type:"element",tagName:"li",properties:h,children:p};return l.patch(e,u),l.applyData(e,u)}function d(l){let e=!1;if(l.type==="list"){e=l.spread||!1;const s=l.children;let i=-1;for(;!e&&++i<s.length;)e=o(s[i])}return e}function o(l){const e=l.spread;return e==null?l.children.length>1:e}exports.listItem=m;