taggedjs 2.4.17 → 2.4.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.js +1314 -1241
- package/bundle.js.map +1 -1
- package/js/Clones.type.d.ts +1 -1
- package/js/Tag.class.d.ts +5 -40
- package/js/Tag.class.js +2 -347
- package/js/Tag.class.js.map +1 -1
- package/js/TagSupport.class.d.ts +40 -6
- package/js/TagSupport.class.js +268 -30
- package/js/TagSupport.class.js.map +1 -1
- package/js/TemplaterResult.class.d.ts +13 -13
- package/js/TemplaterResult.class.js +34 -45
- package/js/TemplaterResult.class.js.map +1 -1
- package/js/afterInterpolateElement.function.d.ts +4 -0
- package/js/afterInterpolateElement.function.js +14 -0
- package/js/afterInterpolateElement.function.js.map +1 -0
- package/js/alterProps.function.d.ts +2 -4
- package/js/alterProps.function.js +7 -15
- package/js/alterProps.function.js.map +1 -1
- package/js/bindSubjectCallback.function.js +0 -3
- package/js/bindSubjectCallback.function.js.map +1 -1
- package/js/checkDestroyPrevious.function.d.ts +5 -5
- package/js/checkDestroyPrevious.function.js +20 -17
- package/js/checkDestroyPrevious.function.js.map +1 -1
- package/js/cloneValueArray.function.d.ts +2 -0
- package/js/cloneValueArray.function.js +19 -0
- package/js/cloneValueArray.function.js.map +1 -0
- package/js/deepFunctions.js +36 -29
- package/js/deepFunctions.js.map +1 -1
- package/js/destroy.support.d.ts +6 -0
- package/js/destroy.support.js +10 -0
- package/js/destroy.support.js.map +1 -0
- package/js/destroyTag.function.d.ts +2 -3
- package/js/destroyTag.function.js +7 -11
- package/js/destroyTag.function.js.map +1 -1
- package/js/hasTagSupportChanged.function.js +0 -12
- package/js/hasTagSupportChanged.function.js.map +1 -1
- package/js/index.d.ts +2 -1
- package/js/index.js +2 -1
- package/js/index.js.map +1 -1
- package/js/interpolateTemplate.js +0 -3
- package/js/interpolateTemplate.js.map +1 -1
- package/js/interpolations/bindSubjectCallback.function.d.ts +7 -0
- package/js/interpolations/bindSubjectCallback.function.js +40 -0
- package/js/interpolations/bindSubjectCallback.function.js.map +1 -0
- package/js/interpolations/elementInitCheck.d.ts +2 -0
- package/js/interpolations/elementInitCheck.js +18 -0
- package/js/interpolations/elementInitCheck.js.map +1 -0
- package/js/interpolations/inputAttribute.d.ts +1 -0
- package/js/interpolations/inputAttribute.js +19 -0
- package/js/interpolations/inputAttribute.js.map +1 -0
- package/js/interpolations/interpolateAttributes.d.ts +4 -0
- package/js/interpolations/interpolateAttributes.js +20 -0
- package/js/interpolations/interpolateAttributes.js.map +1 -0
- package/js/interpolations/interpolateContentTemplates.d.ts +9 -0
- package/js/interpolations/interpolateContentTemplates.js +42 -0
- package/js/interpolations/interpolateContentTemplates.js.map +1 -0
- package/js/interpolations/interpolateElement.d.ts +14 -0
- package/js/interpolations/interpolateElement.js +36 -0
- package/js/interpolations/interpolateElement.js.map +1 -0
- package/js/interpolations/interpolateTemplate.d.ts +32 -0
- package/js/interpolations/interpolateTemplate.js +80 -0
- package/js/interpolations/interpolateTemplate.js.map +1 -0
- package/js/interpolations/interpolations.d.ts +7 -0
- package/js/interpolations/interpolations.js +18 -0
- package/js/interpolations/interpolations.js.map +1 -0
- package/js/interpolations/processAttribute.function.d.ts +5 -0
- package/js/interpolations/processAttribute.function.js +122 -0
- package/js/interpolations/processAttribute.function.js.map +1 -0
- package/js/interpolations/scanTextAreaValue.function.d.ts +3 -0
- package/js/interpolations/scanTextAreaValue.function.js +16 -0
- package/js/interpolations/scanTextAreaValue.function.js.map +1 -0
- package/js/interpolations.js +1 -2
- package/js/interpolations.js.map +1 -1
- package/js/isInstance.d.ts +4 -1
- package/js/isInstance.js +12 -4
- package/js/isInstance.js.map +1 -1
- package/js/isLikeTags.function.d.ts +3 -1
- package/js/isLikeTags.function.js +15 -6
- package/js/isLikeTags.function.js.map +1 -1
- package/js/processNewValue.function.d.ts +3 -2
- package/js/processNewValue.function.js +27 -11
- package/js/processNewValue.function.js.map +1 -1
- package/js/processRegularValue.function.d.ts +1 -1
- package/js/processSubjectComponent.function.d.ts +5 -5
- package/js/processSubjectComponent.function.js +26 -34
- package/js/processSubjectComponent.function.js.map +1 -1
- package/js/processSubjectValue.function.d.ts +11 -7
- package/js/processSubjectValue.function.js +20 -7
- package/js/processSubjectValue.function.js.map +1 -1
- package/js/processTag.function.d.ts +8 -4
- package/js/processTag.function.js +23 -39
- package/js/processTag.function.js.map +1 -1
- package/js/processTagArray.d.ts +6 -4
- package/js/processTagArray.js +41 -39
- package/js/processTagArray.js.map +1 -1
- package/js/processTagResult.function.d.ts +4 -4
- package/js/processTagResult.function.js +14 -30
- package/js/processTagResult.function.js.map +1 -1
- package/js/renderExistingTag.function.d.ts +6 -6
- package/js/renderExistingTag.function.js +26 -22
- package/js/renderExistingTag.function.js.map +1 -1
- package/js/renderTagSupport.function.d.ts +2 -3
- package/js/renderTagSupport.function.js +17 -20
- package/js/renderTagSupport.function.js.map +1 -1
- package/js/setTagPlaceholder.function.d.ts +2 -0
- package/js/setTagPlaceholder.function.js +8 -0
- package/js/setTagPlaceholder.function.js.map +1 -0
- package/js/state/callbackMaker.function.d.ts +2 -2
- package/js/state/callbackMaker.function.js +4 -5
- package/js/state/callbackMaker.function.js.map +1 -1
- package/js/state/onDestroy.js +2 -2
- package/js/state/onDestroy.js.map +1 -1
- package/js/state/onInit.js +4 -5
- package/js/state/onInit.js.map +1 -1
- package/js/state/provider.utils.d.ts +2 -2
- package/js/state/provider.utils.js +11 -16
- package/js/state/provider.utils.js.map +1 -1
- package/js/state/providers.d.ts +8 -3
- package/js/state/providers.js +15 -18
- package/js/state/providers.js.map +1 -1
- package/js/state/setUse.function.d.ts +12 -10
- package/js/state/setUse.function.js.map +1 -1
- package/js/state/state.utils.d.ts +1 -3
- package/js/state/state.utils.js +19 -13
- package/js/state/state.utils.js.map +1 -1
- package/js/state/watch.function.d.ts +6 -1
- package/js/state/watch.function.js +8 -3
- package/js/state/watch.function.js.map +1 -1
- package/js/subject/Subject.class.d.ts +10 -6
- package/js/subject/Subject.class.js +26 -10
- package/js/subject/Subject.class.js.map +1 -1
- package/js/subject/Subject.utils.d.ts +7 -5
- package/js/subject/Subject.utils.js.map +1 -1
- package/js/subject/ValueSubject.d.ts +2 -2
- package/js/subject/ValueSubject.js +1 -1
- package/js/subject/ValueSubject.js.map +1 -1
- package/js/subject/combineLatest.function.js.map +1 -1
- package/js/subject.types.d.ts +18 -0
- package/js/subject.types.js +2 -0
- package/js/subject.types.js.map +1 -0
- package/js/tag.d.ts +1 -1
- package/js/tag.js +25 -31
- package/js/tag.js.map +1 -1
- package/js/tagElement.d.ts +3 -7
- package/js/tagElement.js +24 -24
- package/js/tagElement.js.map +1 -1
- package/js/tagRunner.d.ts +7 -6
- package/js/tagRunner.js +16 -8
- package/js/tagRunner.js.map +1 -1
- package/js/updateBeforeTemplate.function.d.ts +1 -1
- package/js/updateBeforeTemplate.function.js.map +1 -1
- package/js/updateContextItem.function.d.ts +3 -0
- package/js/updateContextItem.function.js +43 -0
- package/js/updateContextItem.function.js.map +1 -0
- package/js/updateExistingTagComponent.function.d.ts +4 -4
- package/js/updateExistingTagComponent.function.js +49 -87
- package/js/updateExistingTagComponent.function.js.map +1 -1
- package/js/updateExistingValue.function.d.ts +2 -7
- package/js/updateExistingValue.function.js +94 -50
- package/js/updateExistingValue.function.js.map +1 -1
- package/package.json +1 -1
- /package/js/{errors.d.ts → Errors.d.ts} +0 -0
- /package/js/{errors.js → Errors.js} +0 -0
- /package/js/{errors.js.map → Errors.js.map} +0 -0
package/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","mappings":";;;;;;;;;AAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAqC;AACR;AACsC;AACF;AACN;AACR;AACI;AACd;AACgB;AAC5D;AACA;AACP;AACO;AACA;AACP;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,oBAAoB;AACpB;AACA,oCAAoC;AACpC;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gFAAgB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,4DAAgB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,mBAAmB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE,4BAA4B;AAChG;AACA,aAAa;AACb;AACA;AACA,yEAAyE,4BAA4B;AACrG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,UAAU;AAC9B;AACA,KAAK;AACL;AACA,0GAA0G;AAC1G,gCAAgC;AAChC;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,kFAAmB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2EAA2E,EAAE,eAAe,EAAE,OAAO;AACrG;AACA;AACA;AACA,SAAS;AACT,8BAA8B,sEAAiB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE;AACnE;AACA;AACA;AACA,eAAe,gEAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,0EAAe;AACnD,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,sBAAsB;AAC5C,SAAS;AACT;AACA;AACA;AACA,kBAAkB,sBAAsB;AACxC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8EAA8E,gBAAgB;AAC9F;AACA,gBAAgB,gBAAgB,EAAE,uEAAkB;AACpD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,yEAAmB,2FAA2F,gBAAgB;AAC1I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,oDAAW;AAC9B;AACA;AACA;AACA,4BAA4B,mEAAa;AACzC;AACA;AACA;AACA;AACA,2CAA2C,YAAY;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,2DAAc;AAC9B;AACA;AACA;AACA;AACA;AACA,QAAQ,8DAAiB;AACzB;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;AC5W4C;AAC6B;AAClE;AACP;AACA;AACA;AACA;AACA;AACA,sBAAsB,+EAA+E;AACrG;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,kDAAkD;AAClD,4CAA4C;AAC5C,6BAA6B,yDAAS,SAAS;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa,0DAAa;AAC1B,4CAA4C,yDAAS;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,0DAAa;AACzB;AACA;AACA,YAAY,2DAAc;AAC1B;AACA,mBAAmB,yDAAS;AAC5B;AACA,YAAY,uDAAU;AACtB;AACA;AACA,eAAe,yDAAS;AACxB,KAAK;AACL;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;AC9D+E;AAC9C;AACkB;AACM;AAClD;AACP;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA,mBAAmB,+EAA+E;AAClG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA,QAAQ,2DAAe;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,2DAAe;AACvB;AACA,0BAA0B,0CAAM;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,0DAAc;AAClB,sCAAsC,gEAAU;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sEAAgB;AACpB;AACA,yBAAyB,uBAAuB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;AC9E6C;AACkB;AAC/D;AACO;AACP;AACA;AACA;AACA,sBAAsB,0DAAa;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,4EAAgB;AACrC;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACjDA;AAC+D;AACxD;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C,aAAa;AACb;AACA,+BAA+B;AAC/B;AACA,IAAI,4EAAgB;AACpB;AACA;AACA;AACA,+CAA+C;AAC/C;AACA,YAAY,4EAAgB;AAC5B;AACA,SAAS;AACT;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;AC1CyE;AACtB;AAC6B;AAC3B;AAC9C;AACP;AACA;AACA;AACA;AACA,qBAAqB,uDAAU;AAC/B;AACA;AACA;AACA,QAAQ,kEAAW;AACnB,4BAA4B,KAAK,4BAA4B,sBAAsB;AACnF;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,0DAAa;AACxC,6BAA6B,0DAAa;AAC1C;AACA;AACA;AACA,iBAAiB,gEAAU;AAC3B;AACA;AACA,gBAAgB,sEAAgB;AAChC;AACA;AACA;AACA;AACA,oCAAoC,2DAAc;AAClD;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA,QAAQ,sEAAgB;AACxB;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP,IAAI,2EAAqB;AACzB;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,QAAQ,kEAAW;AACnB;AACA;;;;;;;;;;;;;;;;AC5EO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,gBAAgB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,iBAAiB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;AC7FO;AACP;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;;;;;;;;;;;;;;;AChBO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;;;;;;;;;;;;;;;ACfO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;;;;;;;;;;;;;;;;;;AChBO;AACP;AACA,gDAAgD;AAChD;AACA;AACA,yBAAyB;AACzB;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACzB4C;AACrC;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB,4BAA4B,wBAAwB;AACpD;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA,qCAAqC;AACrC,yCAAyC;AACzC;AACA,SAAS;AACT;AACA,sBAAsB;AACtB;AACA;AACA,oBAAoB,yDAAS;AAC7B,gCAAgC;AAChC;AACO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;;;;;;;;;;AChFkC;AAC3B;AACP,eAAe,2CAAG;AAClB;;;;;;;;;;;;;;;ACHO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACjBA;AACO;AACP;AACA;AACA;;;;;;;;;;;;;;;;ACJ+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,4EAAgB;AACxB,sCAAsC;AACtC,KAAK;AACL;;;;;;;;;;;;;;;;AClB4D;AACrD;AACP;AACA,iBAAiB,iCAAiC;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,mCAAmC,EAAE,yEAAmB;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,eAAe,EAAE,yEAAmB;AAChE;AACA;AACA;AACA;AACA,wBAAwB,sDAAsD;AAC9E;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACxCgE;AACN;AACkB;AACjB;AAC3D;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,uDAAuD,EAAE,yFAA2B;AACpG;AACA;AACA;AACA,IAAI,6EAAqB;AACzB;AACA,aAAa;AACb;AACA;AACA;AACA,QAAQ,6EAAqB;AAC7B;AACA;AACA;AACA,KAAK;AACL;AACO;AACP,mBAAmB,uEAAsB;AACzC,0CAA0C,oDAAY,EAAE,sDAAc;AACtE;AACA;;;;;;;;;;;;;;;;;;;;;;;AClC6C;AACS;AACe;AACX;AACO;AACI;AAC9D;AACP,+BAA+B,WAAW,MAAM;AAChD;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,UAAU;AAC3B;AACA;AACA,mCAAmC,sDAAc,aAAa,sDAAc;AAC5E,iBAAiB,UAAU;AAC3B;AACA;AACA,sBAAsB,2DAAc,2BAA2B,uDAAU;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2EAA2E,gBAAgB;AAC3F,aAAa;AACb;AACO;AACP,EAAE,gBAAgB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,kFAAmB;AAC/B;AACA;AACA;AACA;AACA;AACA,QAAQ,kFAAmB;AAC3B,sBAAsB,WAAW;AACjC;AACA,SAAS;AACT;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,kCAAkC;AAClC;AACA,QAAQ,8EAAiB;AACzB;AACA;AACA,WAAW,mEAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;;;;;;;;;;;;;;;AC1FA;AACO,sGAAsG,WAAW,GAAG;AAC3H,eAAe,GAAG;AACX;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,GAAG,UAAU,KAAK;AAClE,KAAK;AACL,aAAa;AACb;;;;;;;;;;;;;;;;;;ACjBO;AACP;AACA;AACO;AACP;AACA;AACO;AACP,+EAA+E;AAC/E;AACO;AACP;AACA;;;;;;;;;;;;;;;ACXO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,KAAK;AACL;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;AC5BkD;AACD;AACoB;AACrE,wBAAwB;AACxB,kBAAkB;AAClB;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,sEAAsE;AACtE;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,+DAAc;AAC7B;AACA;AACA,yDAAyD;AACzD;AACA,8DAA8D,UAAU;AACxE;AACA;AACA;AACA;AACA,iCAAiC,8CAA8C;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,8DAAiB;AACzB;AACA;AACA;AACA,+BAA+B,kFAAmB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,+DAAc;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACxHsD;AAC0B;AACzE;AACP,QAAQ,2DAAc;AACtB,+BAA+B,+DAAY;AAC3C;AACA;AACA;AACA;AACA,mBAAmB,+DAAY;AAC/B;AACA;AACA,gBAAgB;AAChB;AACA,QAAQ,0DAAa;AACrB;AACA;AACA;AACA;AACA,mBAAmB,+DAAY;AAC/B;AACA,QAAQ,8DAAiB;AACzB,sBAAsB;AACtB;AACA,eAAe,+DAAY;AAC3B;;;;;;;;;;;;;;;;ACzBuE;AAChE;AACP;AACA;AACA,kDAAkD;AAClD;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,kBAAkB,oFAAoB;AACtC,2BAA2B;AAC3B;;;;;;;;;;;;;;;;;;;ACb4D;AAC3B;AAC8B;AACf;AACzC;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uIAAuI,MAAM;AAC7I;AACA;AACA,+BAA+B,yDAAU;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,0CAAM;AAC5B;AACA;AACA;AACA;AACA;AACA,IAAI,4EAAgB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,yEAAiB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACvD6E;AACJ;AACrB;AACiB;AAClB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,gCAAgC;AACjC;AACA,QAAQ,2DAAc;AACtB;AACA;AACA,QAAQ,0DAAa;AACrB;AACA;AACA,QAAQ,uDAAU;AAClB;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,gEAAU;AACtB;AACA;AACA,mBAAmB,iEAAe;AAClC;AACA,YAAY,0FAAuB;AACnC;AACA;AACA,IAAI,kFAAmB;AACvB;;;;;;;;;;;;;;;;;;;ACxC6C;AACG;AACP;AACzC;AACO;AACP;AACA;AACA;AACA,aAAa,0DAAa;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iFAAiF,qBAAqB;AACtG;AACA;AACA,kBAAkB,sBAAsB;AACxC;AACA,KAAK;AACL;AACO;AACP;AACA;AACA;AACA;AACA,yBAAyB,yDAAU;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA,+BAA+B;AAC/B,SAAS;AACT,sBAAsB,kDAAY;AAClC,iBAAiB;AACjB;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;;;;;;;;;;;;;;;;;;;ACzDsD;AACX;AACuB;AACP;AACpD;AACP;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,+EAAe;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,gCAAgC,+DAAY,GAAG;AAC/C,QAAQ,wEAAkB;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,oDAAe;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,4CAA4C;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACpHO;AACP;AACA,EAAE,uBAAuB;AACzB;AACA,wDAAwD,sBAAsB;AAC9E;AACA;AACA;AACA;AACA,sFAAsF;AACtF,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mFAAmF,sBAAsB;AACzG;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AC5CO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACf8D;AACF;AACT;AACnD;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,2EAAoB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iGAAiG;AACjG,mBAAmB,yEAAiB;AACpC;AACA;AACA,QAAQ,gEAAU;AAClB;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;AC7B4C;AACC;AACoB;AACjE;AACO;AACP;AACA,QAAQ,0DAAa;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,yDAAS;AACvC;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA,gBAAgB,8EAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACxC+D;AAC/D,0EAA0E,IAAI;AACvE;AACP;AACA;AACA,+CAA+C,IAAI;AACnD;AACA,0BAA0B,cAAc;AACxC;AACA;AACA;AACA,QAAQ,4EAAgB;AACxB;AACA;AACA;;;;;;;;;;;;;;;;;;;ACd2C;AACG;AACkB;AAClB;AAC9C;AACA,cAAc,sDAAiB;AAC/B;AACO;AACP,sCAAsC;AACtC,wDAAM;AACN;AACA;AACA;AACA,wCAAwC;AACxC,KAAK;AACL,CAAC;AACD;AACA;AACA,0BAA0B,2DAAa;AACvC;AACA;AACA,iCAAiC;AACjC;AACA,8CAA8C;AAC9C,KAAK;AACL;AACA;AACA,qBAAqB,oDAAM;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,4EAAgB;AACpB;AACA;AACA;AACA;AACA,YAAY,4EAAgB;AAC5B,SAAS;AACT;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AClDiC;AACU;AACF;AACM;AACF;AACL;AACC;AAChB;AACG;;;;;;;;;;;;;;;;;ACRkB;AACH;AAC3C;AACO;AACP,mBAAmB,oDAAM;AACzB;AACA;AACA;AACA;AACA,uBAAuB,2DAAa;AACpC;AACA;AACA,uBAAuB,2DAAa;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2DAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACxC2C;AAC3C;AACA;AACO;AACP;AACA;AACA,wDAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;;;;;;;;;;;;;;ACf0C;AAC3C;AACA,IAAI,oDAAM;AACV;AACO;AACP,sBAAsB,oDAAM;AAC5B;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA,wDAAM;AACN;AACA;AACA,CAAC;;;;;;;;;;;;;;;;;ACfuD;AACQ;AACzD;AACP;AACA,sEAAsE,yDAAS;AAC/E;AACA;AACA;AACA;AACA,yBAAyB,yDAAS;AAClC,KAAK;AACL;AACA;AACA;AACA,gCAAgC,4BAA4B;AAC5D;AACA,oBAAoB;AACpB;AACA;AACA;AACA,6BAA6B,yDAAS;AACtC,YAAY,4EAAgB;AAC5B;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,sBAAsB,KAAK;AAC3B;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;;;;;;;;;;;AC3C6C;AACF;AAC3C;AACA,oDAAM;AACN;AACA;AACA;AACA;AACA;AACA,mBAAmB,oDAAM;AACzB;AACA;AACA;AACO;AACP;AACA;AACA;AACA,6BAA6B,yDAAS;AACtC;AACA;AACA;AACA;AACA,uBAAuB,oDAAM;AAC7B;AACA;AACA;AACA,mBAAmB,yDAAS;AAC5B,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA,eAAe,uCAAuC;AACtD,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,oDAAM;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,iCAAiC,yDAAS,qBAAqB;AAC/D;AACA;AACA;AACA,oCAAoC;AACpC;AACA,kDAAkD,kBAAkB,EAAE,YAAY;AAClF,wBAAwB,IAAI;AAC5B;AACA;AACA;AACA,wDAAM;AACN;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA,uBAAuB,oDAAM;AAC7B;AACA;AACA;AACA,CAAC;AACD;AACA,mBAAmB,oDAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACpF8C;AACH;AAC3C;AACO;AACP,mBAAmB,oDAAM;AACzB;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA,uBAAuB,2DAAa;AACpC;AACA,uBAAuB,2DAAa;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2DAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACnCA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACZ2C;AACG;AAC9C;AACO;AACP,mBAAmB,oDAAM;AACzB;AACA;AACA;AACA;AACA,uBAAuB,2DAAa;AACpC;AACA;AACA,uBAAuB,2DAAa;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2DAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;AChC+C;AACJ;AAC3C;AACA,oDAAM;AACN;AACA;AACA;AACA,wDAAM;AACN;AACA;AACA;AACA;AACA,uBAAuB,oDAAM;AAC7B;AACA;AACA;AACA,8DAA8D,gBAAgB,MAAM,oBAAoB;AACxG;AACA;AACA;AACA;AACA;AACA,kCAAkC,uDAAkB;AACpD;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,qCAAqC;AACrC,4EAA4E;AAC5E;AACA;AACA,CAAC;AACM;AACP;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA,iCAAiC,iDAAiD;AAClF;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,mBAAmB,oDAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,kBAAkB,uDAAkB;AACpC;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACnF+C;AAC/C;AACO;AACP,yBAAyB,4DAAQ;AACjC;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AClBO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;;;;;;;;;;;;;;;;ACrG0C;AACnC,2BAA2B,mDAAO;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACb0C;AACnC;AACP,uBAAuB,mDAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;ACtBgC;AACD;AACU;AACR;;;;;;;;;;;;;;;;;ACH1B;AACP;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACO;AACP;AACA;AACA;AACA,SAAS,GAAG;AACZ;AACA;AACA,KAAK;AACL;AACA;AACO;AACP;AACA;AACA;AACA,SAAS,GAAG;AACZ;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;;;;;;;;;;;;;;;;;;;;;;;AC9B4E;AAC3C;AACyB;AACM;AACpB;AACI;AACG;AACG;AAC/C;AACP;AACA;AACA;AACO;AACP;AACA,0BAA0B,0DAAa,WAAW,uDAAU;AAC5D;AACA;AACA;AACA;AACA,gBAAgB,4BAA4B;AAC5C;AACA,8BAA8B,mEAAe;AAC7C;AACA;AACA;AACA;AACA;AACA,KAAK,GAAG;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,8DAAiB;AACzB,iBAAiB;AACjB;AACA;AACA,QAAQ,uDAAU;AAClB,iBAAiB,kBAAkB,+DAAY;AAC/C;AACA;AACA;AACA;AACA,iBAAiB,kBAAkB,+DAAY;AAC/C;AACA;AACA,0BAA0B,+DAAY;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,0CAAM;AAChC,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,gEAAU;AACpC,4BAA4B,yDAAS,SAAS;AAC9C;AACA;AACA;AACA,6BAA6B,yDAAU;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA,wBAAwB,6EAAc;AACtC;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;AC5HoD;AACU;AACR;AACtD;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,sFAAsF,SAAS;AAC/F;AACA;AACA;AACA,mEAAmE,kBAAkB;AACrF;AACA,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,cAAc;AACrC,aAAa;AACb;AACO;AACP,wBAAwB,+DAAY,GAAG;AACvC,2BAA2B,6DAAc;AACzC;AACA,IAAI,2DAAe;AACnB;AACA;AACA;AACA;AACA,IAAI,0DAAc;AAClB,aAAa;AACb;;;;;;;;;;;;;;;;;;;AC/CA,wDAAwD;AACvB;AACjC;AACO;AACP,IAAI,0CAAM;AACV;AACA;AACO;AACP,IAAI,0CAAM;AACV;AACA;AACO;AACP,IAAI,0CAAM;AACV;AACA;AACO;AACP,IAAI,0CAAM;AACV;;;;;;;;;;;;;;;ACjBA;AACO;AACP;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACduE;AACM;AACpB;AACM;AACL;AACnD;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,sEAAgB;AACxB,eAAe,0FAAuB;AACtC;AACA;AACA;AACA;AACA,sBAAsB,sBAAsB;AAC5C,SAAS;AACT;AACA;AACA;AACA,2BAA2B,oFAAoB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA,mBAAmB,4EAAgB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA,YAAY,sEAAgB;AAC5B,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,kBAAkB,sBAAsB;AACxC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,mBAAmB,uEAAiB;AACpC;AACA;AACA;AACA,KAAK;AACL;;;;;;;;;;;;;;;;;;;;;;;;;AClJgD;AAC4C;AACxC;AAC+B;AACd;AACE;AACM;AAC1B;AACkB;AACE;AAChE;AACP;AACA,wBAAwB,2DAAc;AACtC,IAAI,oFAAoB;AACxB;AACA;AACA;AACA;AACA;AACA,YAAY,0FAAuB;AACnC;AACA;AACA,0BAA0B,sBAAsB;AAChD,aAAa;AACb;AACA;AACA,mCAAmC,yDAAU;AAC7C;AACA;AACA,QAAQ,gGAA0B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,uDAAU;AAClB,QAAQ,iEAAe;AACvB,oBAAoB;AACpB;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA,sBAAsB,kFAAmB;AACzC;AACA;AACA;AACA,QAAQ,0DAAa;AACrB;AACA,mDAAmD,sBAAsB;AACzE;AACA,QAAQ,gEAAU;AAClB;AACA;AACA;AACA,QAAQ,8DAAiB;AACzB;AACA;AACA;AACA,IAAI,kFAAmB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,gEAAU;AACzC;AACA;AACA;AACA,QAAQ,wEAAkB;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,gEAAU;AACzB;AACA,WAAW,kFAAmB;AAC9B;;;;;;;SC5FA;SACA;;SAEA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;;SAEA;SACA;;SAEA;SACA;SACA;;;;;UCtBA;UACA;UACA;UACA;UACA,yCAAyC,wCAAwC;UACjF;UACA;UACA;;;;;UCPA;;;;;UCAA;UACA;UACA;UACA,uDAAuD,iBAAiB;UACxE;UACA,gDAAgD,aAAa;UAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNA,YAAY,YAAY;AACkB;AACK;AACzB;AACC;AACE;AACO;AACH;AACC;AACK;AACnC;AACqC;AACrC;AAC0C;AACR;AACY;AACvC;AACP,cAAc;AACd;AACA","sources":["webpack://taggedjs/./ts/ElementTargetEvent.interface.ts","webpack://taggedjs/./ts/Tag.class.ts","webpack://taggedjs/./ts/TagSupport.class.ts","webpack://taggedjs/./ts/TemplaterResult.class.ts","webpack://taggedjs/./ts/alterProps.function.ts","webpack://taggedjs/./ts/bindSubjectCallback.function.ts","webpack://taggedjs/./ts/checkDestroyPrevious.function.ts","webpack://taggedjs/./ts/deepFunctions.ts","webpack://taggedjs/./ts/destroyTag.function.ts","webpack://taggedjs/./ts/elementDestroyCheck.function.ts","webpack://taggedjs/./ts/elementInitCheck.ts","webpack://taggedjs/./ts/errors.ts","webpack://taggedjs/./ts/hasTagSupportChanged.function.ts","webpack://taggedjs/./ts/html.ts","webpack://taggedjs/./ts/inputAttribute.ts","webpack://taggedjs/./ts/insertAfter.function.ts","webpack://taggedjs/./ts/interpolateAttributes.ts","webpack://taggedjs/./ts/interpolateContentTemplates.ts","webpack://taggedjs/./ts/interpolateElement.ts","webpack://taggedjs/./ts/interpolateTemplate.ts","webpack://taggedjs/./ts/interpolations.ts","webpack://taggedjs/./ts/isInstance.ts","webpack://taggedjs/./ts/isLikeTags.function.ts","webpack://taggedjs/./ts/processAttribute.function.ts","webpack://taggedjs/./ts/processNewValue.function.ts","webpack://taggedjs/./ts/processRegularValue.function.ts","webpack://taggedjs/./ts/processSubjectComponent.function.ts","webpack://taggedjs/./ts/processSubjectValue.function.ts","webpack://taggedjs/./ts/processTag.function.ts","webpack://taggedjs/./ts/processTagArray.ts","webpack://taggedjs/./ts/processTagResult.function.ts","webpack://taggedjs/./ts/render.ts","webpack://taggedjs/./ts/renderExistingTag.function.ts","webpack://taggedjs/./ts/renderTagSupport.function.ts","webpack://taggedjs/./ts/scanTextAreaValue.function.ts","webpack://taggedjs/./ts/state/callbackMaker.function.ts","webpack://taggedjs/./ts/state/index.ts","webpack://taggedjs/./ts/state/letState.function.ts","webpack://taggedjs/./ts/state/onDestroy.ts","webpack://taggedjs/./ts/state/onInit.ts","webpack://taggedjs/./ts/state/provider.utils.ts","webpack://taggedjs/./ts/state/providers.ts","webpack://taggedjs/./ts/state/setProp.function.ts","webpack://taggedjs/./ts/state/setUse.function.ts","webpack://taggedjs/./ts/state/state.function.ts","webpack://taggedjs/./ts/state/state.utils.ts","webpack://taggedjs/./ts/state/watch.function.ts","webpack://taggedjs/./ts/subject/Subject.class.ts","webpack://taggedjs/./ts/subject/ValueSubject.ts","webpack://taggedjs/./ts/subject/combineLatest.function.ts","webpack://taggedjs/./ts/subject/index.ts","webpack://taggedjs/./ts/subject/will.functions.ts","webpack://taggedjs/./ts/tag.ts","webpack://taggedjs/./ts/tagElement.ts","webpack://taggedjs/./ts/tagRunner.ts","webpack://taggedjs/./ts/updateBeforeTemplate.function.ts","webpack://taggedjs/./ts/updateExistingTagComponent.function.ts","webpack://taggedjs/./ts/updateExistingValue.function.ts","webpack://taggedjs/webpack/bootstrap","webpack://taggedjs/webpack/runtime/define property getters","webpack://taggedjs/webpack/runtime/hasOwnProperty shorthand","webpack://taggedjs/webpack/runtime/make namespace object","webpack://taggedjs/./ts/index.ts"],"sourcesContent":["export {};\n","import { runBeforeDestroy } from './tagRunner';\nimport { buildClones } from './render';\nimport { interpolateElement, interpolateString } from './interpolateElement';\nimport { afterElmBuild, subscribeToTemplate } from './interpolateTemplate';\nimport { elementDestroyCheck } from './elementDestroyCheck.function';\nimport { processNewValue } from './processNewValue.function';\nimport { isSubjectInstance, isTagComponent } from './isInstance';\nimport { isLikeTags } from './isLikeTags.function';\nimport { restoreTagMarker } from './checkDestroyPrevious.function';\nexport const variablePrefix = '__tagvar';\nexport const escapeVariable = '--' + variablePrefix + '--';\nconst prefixSearch = new RegExp(variablePrefix, 'g');\nexport const escapeSearch = new RegExp(escapeVariable, 'g');\nexport class Tag {\n strings;\n values;\n version = 0;\n isTag = true;\n hasLiveElements = false;\n clones = []; // elements on document. Needed at destroy process to know what to destroy\n childTags = []; // tags on me\n tagSupport;\n lastTemplateString = undefined; // used to compare templates for updates\n // only present when a child of a tag\n ownerTag;\n // insertBefore?: Element\n appElement; // only seen on this.getAppElement().appElement\n // present only when an array. Populated by Tag.key()\n memory = {};\n constructor(strings, values) {\n this.strings = strings;\n this.values = values;\n }\n /** Used for array, such as array.map(), calls aka array.map(x => html``.key(x)) */\n key(arrayValue) {\n this.memory.arrayValue = arrayValue;\n return this;\n }\n destroy(options = {\n stagger: 0,\n byParent: false, // Only destroy clones of direct children\n }) {\n if (!this.hasLiveElements) {\n throw new Error('destroying wrong tag');\n }\n const tagSupport = this.tagSupport;\n const global = tagSupport.templater.global;\n // removing is considered rendering. Prevents after event processing of this tag even tho possibly deleted\n // ++this.tagSupport.templater.global.renderCount\n const subject = tagSupport.subject;\n // put back down the template tag\n const insertBefore = global.insertBefore;\n if (insertBefore.nodeName === 'TEMPLATE') {\n const placeholder = global.placeholder;\n if (placeholder && !('arrayValue' in this.memory)) {\n if (!options.byParent) {\n restoreTagMarker(this, insertBefore);\n }\n }\n }\n delete global.placeholder;\n // the isComponent check maybe able to be removed\n const isComponent = tagSupport ? true : false;\n if (isComponent) {\n runBeforeDestroy(tagSupport, this);\n }\n const childTags = options.byParent ? [] : getChildTagsToDestroy(this.childTags);\n // signify that no further event rendering should take place by making logic think a render occurred during event\n // signify immediately child has been deleted (looked for during event processing)\n childTags.forEach(child => {\n const subGlobal = child.tagSupport.templater.global;\n delete subGlobal.newest;\n subGlobal.deleted = true;\n });\n delete global.oldest;\n delete global.newest;\n global.deleted = true;\n this.hasLiveElements = false;\n delete subject.tag;\n this.destroySubscriptions();\n let mainPromise;\n if (this.ownerTag) {\n this.ownerTag.childTags = this.ownerTag.childTags.filter(child => child !== this);\n }\n if (!options.byParent) {\n const { stagger, promise } = this.destroyClones(options);\n options.stagger = stagger;\n if (promise) {\n mainPromise = promise;\n }\n }\n else {\n this.destroyClones();\n }\n if (mainPromise) {\n mainPromise = mainPromise.then(async () => {\n const promises = childTags.map(kid => kid.destroy({ stagger: 0, byParent: true }));\n return Promise.all(promises);\n });\n }\n else {\n mainPromise = Promise.all(childTags.map(kid => kid.destroy({ stagger: 0, byParent: true })));\n }\n return mainPromise.then(() => options.stagger);\n }\n destroySubscriptions() {\n const global = this.tagSupport.templater.global;\n global.subscriptions.forEach(cloneSub => cloneSub.unsubscribe());\n global.subscriptions.length = 0;\n }\n destroyClones({ stagger } = {\n stagger: 0,\n }) {\n //const promises = this.clones.reverse().map(\n const promises = this.clones.map(clone => this.checkCloneRemoval(clone, stagger)).filter(x => x); // only return promises\n this.clones.length = 0; // tag maybe used for something else\n if (promises.length) {\n return { promise: Promise.all(promises), stagger };\n }\n return { stagger };\n }\n /** Reviews elements for the presences of ondestroy */\n checkCloneRemoval(clone, stagger) {\n let promise;\n const customElm = clone;\n if (customElm.ondestroy) {\n promise = elementDestroyCheck(customElm, stagger);\n }\n const next = () => {\n clone.parentNode?.removeChild(clone);\n const ownerTag = this.ownerTag;\n if (ownerTag) {\n // Sometimes my clones were first registered to my owner, remove them from owner\n ownerTag.clones = ownerTag.clones.filter(compareClone => compareClone !== clone);\n }\n };\n if (promise instanceof Promise) {\n return promise.then(next);\n }\n else {\n next();\n }\n return promise;\n }\n getTemplate() {\n const string = this.strings.map((string, index) => {\n const safeString = string.replace(prefixSearch, escapeVariable);\n const endString = safeString + (this.values.length > index ? `{${variablePrefix}${index}}` : '');\n // const trimString = index === 0 || index === this.strings.length-1 ? endString.trim() : endString\n const trimString = endString.replace(/>\\s*/g, '>').replace(/\\s*</g, '<');\n return trimString;\n }).join('');\n const interpolation = interpolateString(string);\n this.lastTemplateString = interpolation.string;\n return {\n interpolation,\n // string,\n string: interpolation.string,\n strings: this.strings,\n values: this.values,\n context: this.tagSupport.templater.global.context || {},\n };\n }\n isLikeTag(tag) {\n return isLikeTags(this, tag);\n }\n updateByTag(tag) {\n if (!this.tagSupport.templater.global.oldest) {\n throw new Error('no oldest here');\n }\n if (!this.hasLiveElements) {\n throw new Error('trying to update a tag with no elements on stage');\n }\n this.tagSupport.templater.global.newest = tag;\n if (!this.tagSupport.templater.global.context) {\n throw new Error('issue back here');\n }\n this.updateConfig(tag.strings, tag.values);\n }\n updateConfig(strings, values) {\n this.strings = strings;\n this.updateValues(values);\n }\n update() {\n return this.updateContext(this.tagSupport.templater.global.context);\n }\n updateValues(values) {\n this.values = values;\n return this.updateContext(this.tagSupport.templater.global.context);\n }\n updateContext(context) {\n this.strings.map((_string, index) => {\n const variableName = variablePrefix + index;\n const hasValue = this.values.length > index;\n const value = this.values[index];\n // is something already there?\n const exists = variableName in context;\n if (exists) {\n return updateContextItem(context, variableName, value);\n }\n if (!hasValue) {\n return;\n }\n // 🆕 First time values below\n context[variableName] = processNewValue(hasValue, value, this);\n });\n return context;\n }\n getAppElement() {\n let tag = this;\n while (tag.ownerTag) {\n tag = tag.ownerTag;\n }\n return tag;\n }\n /** Used during HMR only where static content itself could have been edited */\n rebuild() {\n // const insertBefore = this.insertBefore\n const insertBefore = this.tagSupport.templater.global.insertBefore;\n if (!insertBefore) {\n const err = new Error('Cannot rebuild. Previous insertBefore element is not defined on tag');\n err.tag = this;\n throw err;\n }\n this.buildBeforeElement(insertBefore, {\n forceElement: true,\n counts: { added: 0, removed: 0 },\n });\n }\n buildBeforeElement(insertBefore, options = {\n forceElement: false,\n counts: { added: 0, removed: 0 },\n }) {\n const subject = this.tagSupport.subject;\n const thisTemplater = this.tagSupport.templater;\n const global = thisTemplater.global;\n global.insertBefore = insertBefore;\n if (!global.placeholder) {\n if (insertBefore.nodeName !== 'TEMPLATE') {\n throw new Error(' no template at insertBefore');\n global.placeholder = insertBefore;\n }\n else {\n setTagPlaceholder(global);\n }\n }\n if (!global.placeholder?.parentNode) {\n throw new Error('????');\n }\n const placeholderElm = global.placeholder;\n global.oldest = this;\n global.newest = this;\n subject.tag = this;\n this.hasLiveElements = true;\n // remove old clones\n if (this.clones.length) {\n this.clones.forEach(clone => this.checkCloneRemoval(clone, 0));\n }\n global.insertBefore = insertBefore;\n // const context = this.tagSupport.memory.context // this.update()\n const context = this.update();\n const template = this.getTemplate();\n if (!placeholderElm.parentNode) {\n throw new Error('no parent before building tag');\n }\n const elementContainer = document.createElement('div');\n elementContainer.id = 'tag-temp-holder';\n // render content with a first child that we can know is our first element\n elementContainer.innerHTML = `<template id=\"temp-template-tag-wrap\">${template.string}</template>`;\n // Search/replace innerHTML variables but don't interpolate tag components just yet\n const { tagComponents } = interpolateElement(elementContainer, context, template, this, // ownerTag,\n {\n forceElement: options.forceElement,\n counts: options.counts\n });\n if (!placeholderElm.parentNode) {\n throw new Error('no parent after building tag');\n }\n afterInterpolateElement(elementContainer, placeholderElm, this, // ownerTag\n context, options);\n if (!global.placeholder?.parentNode) {\n throw new Error('???? - 2');\n }\n // Any tag components that were found should be processed AFTER the owner processes its elements. Avoid double processing of elements attributes like (oninit)=${}\n let isForceElement = options.forceElement;\n tagComponents.forEach(tagComponent => {\n const tagSupport = tagComponent.ownerTag.tagSupport;\n const tagGlobal = tagSupport.templater.global;\n const placeholderElm = tagGlobal.placeholder; // global.placeholderElm\n if (!placeholderElm && !insertBefore.parentNode) {\n throw new Error('no parent building tag components');\n }\n if (!global.placeholder?.parentNode) {\n throw new Error('???? - 3');\n }\n subscribeToTemplate(tagComponent.insertBefore, tagComponent.subject, tagComponent.ownerTag, options.counts, { isForceElement });\n if (!global.placeholder?.parentNode) {\n throw new Error('???? - 4');\n }\n afterInterpolateElement(elementContainer, tagComponent.insertBefore, tagComponent.ownerTag, // this, // ownerTag\n context, options);\n if (!global.placeholder?.parentNode) {\n throw new Error('???? - 5');\n }\n });\n }\n}\nfunction setTagPlaceholder(global) {\n const insertBefore = global.insertBefore;\n const placeholder = global.placeholder = document.createTextNode('');\n const parentNode = insertBefore.parentNode;\n parentNode.insertBefore(placeholder, insertBefore);\n parentNode.removeChild(insertBefore);\n}\nfunction afterInterpolateElement(container, insertBefore, tag, \n// preClones: Clones,\ncontext, options) {\n const clones = buildClones(container, insertBefore);\n if (!clones.length) {\n return clones;\n }\n clones.forEach(clone => afterElmBuild(clone, options, context, tag));\n tag.clones.push(...clones);\n return clones;\n}\nfunction getChildTagsToDestroy(childTags, allTags = []) {\n for (let index = childTags.length - 1; index >= 0; --index) {\n const cTag = childTags[index];\n if (allTags.find(x => x === cTag)) {\n // TODO: Lets find why a child tag is attached twice to owner\n throw new Error('child tag registered twice for delete');\n }\n allTags.push(cTag);\n childTags.splice(index, 1);\n getChildTagsToDestroy(cTag.childTags, allTags);\n }\n return allTags;\n}\nfunction updateContextItem(context, variableName, value) {\n const subject = context[variableName];\n const tag = subject.tag;\n if (tag) {\n const oldTemp = tag.tagSupport.templater;\n if (value && value.global !== oldTemp.global) {\n if (isTagComponent(value)) {\n shareTemplaterGlobal(oldTemp, value);\n }\n }\n }\n // return updateExistingValue(subject, value, this)\n if (isSubjectInstance(value)) {\n return;\n }\n subject.set(value); // listeners will evaluate updated values to possibly update display(s)\n return;\n}\nfunction shareTemplaterGlobal(oldTemp, value) {\n const oldWrap = oldTemp.wrapper; // tag versus component\n const oldValueFn = oldWrap.original;\n const newValueFn = value.wrapper?.original;\n const fnMatched = oldValueFn === newValueFn;\n if (fnMatched) {\n value.global = oldTemp.global;\n }\n}\n","import { deepClone } from './deepFunctions';\nimport { isTagArray, isTagComponent, isTagInstance } from './isInstance';\nexport class BaseTagSupport {\n templater;\n subject;\n isApp = true;\n propsConfig;\n memory = {\n // context: {}, // populated after reading interpolated.values array converted to an object {variable0, variable:1}\n state: {\n newest: [],\n },\n };\n constructor(templater, subject) {\n this.templater = templater;\n this.subject = subject;\n const children = this.templater.children; // children tags passed in as arguments\n const props = this.templater.props; // natural props\n const latestCloned = deepClone(props); // alterProps(props, templater)\n this.propsConfig = {\n latest: props,\n latestCloned, // assume its HTML children and then detect\n clonedProps: latestCloned, // maybe duplicate\n lastClonedKidValues: children.value.map(kid => {\n const cloneValues = cloneValueArray(kid.values);\n return cloneValues;\n })\n };\n // if the latest props are not HTML children, then clone the props for later render cycles to compare\n if (!isTagInstance(props)) {\n this.propsConfig.latestCloned = deepClone(latestCloned);\n this.propsConfig.clonedProps = this.propsConfig.latestCloned;\n }\n }\n}\nfunction cloneValueArray(values) {\n return values.map((value) => {\n const tag = value;\n if (isTagInstance(tag)) {\n return cloneValueArray(tag.values);\n }\n if (isTagComponent(tag)) {\n const tagComponent = tag;\n return deepClone(tagComponent.props);\n }\n if (isTagArray(tag)) {\n return cloneValueArray(tag);\n }\n return deepClone(value);\n });\n}\nexport class TagSupport extends BaseTagSupport {\n ownerTagSupport;\n templater;\n subject;\n isApp = false;\n constructor(ownerTagSupport, templater, subject) {\n super(templater, subject);\n this.ownerTagSupport = ownerTagSupport;\n this.templater = templater;\n this.subject = subject;\n }\n}\n","import { runAfterRender, runBeforeRedraw, runBeforeRender } from './tagRunner';\nimport { setUse } from './state';\nimport { isLikeTags } from './isLikeTags.function';\nimport { destroyTagMemory } from './destroyTag.function';\nexport class TemplaterResult {\n props;\n children;\n isTag = false; // when true, is basic tag non-component\n tagged;\n wrapper;\n global = {\n newestTemplater: this,\n context: {}, // populated after reading interpolated.values array converted to an object {variable0, variable:1}\n providers: [],\n /** Indicator of re-rending. Saves from double rending something already rendered */\n renderCount: 0,\n deleted: false,\n subscriptions: []\n };\n tagSupport;\n constructor(props, children) {\n this.props = props;\n this.children = children;\n }\n /*\n redraw?: (\n force?: boolean, // force children to redraw\n ) => Tag\n */\n isTemplater = true;\n}\nexport function renderWithSupport(tagSupport, existingTag, subject, ownerTag) {\n const wrapTagSupport = tagSupport; // this.tagSupport\n /* BEFORE RENDER */\n const runtimeOwnerTag = existingTag?.ownerTag || ownerTag;\n if (existingTag) {\n wrapTagSupport.memory.state.newest = [...existingTag.tagSupport.memory.state.newest];\n wrapTagSupport.templater.global = existingTag.tagSupport.templater.global;\n runBeforeRedraw(wrapTagSupport, existingTag);\n }\n else {\n if (!wrapTagSupport) {\n throw new Error('63521');\n }\n // first time render\n runBeforeRender(wrapTagSupport, runtimeOwnerTag);\n // TODO: Logic below most likely could live within providers.ts inside the runBeforeRender function\n const providers = setUse.memory.providerConfig;\n providers.ownerTag = runtimeOwnerTag;\n }\n /* END: BEFORE RENDER */\n const templater = wrapTagSupport.templater;\n // NEW TAG CREATED HERE\n const retag = templater.wrapper(wrapTagSupport, subject);\n /* AFTER */\n runAfterRender(wrapTagSupport, retag);\n const isLikeTag = !existingTag || isLikeTags(existingTag, retag);\n if (!isLikeTag) {\n destroyUnlikeTags(existingTag, templater, subject);\n }\n retag.ownerTag = runtimeOwnerTag;\n wrapTagSupport.templater.global.newest = retag;\n return retag;\n}\nfunction destroyUnlikeTags(existingTag, // old\ntemplater, // new\nsubject) {\n const oldGlobal = existingTag.tagSupport.templater.global;\n const insertBefore = oldGlobal.insertBefore;\n destroyTagMemory(existingTag, subject);\n // ??? - new so that when a tag is destroy the unlike does not carry the destroy signifier\n templater.global = { ...templater.global }; // break memory references\n const global = templater.global;\n global.insertBefore = insertBefore;\n global.deleted = false;\n delete global.oldest;\n delete global.newest;\n delete subject.tag;\n}\n","import { isTagInstance } from './isInstance';\nimport { renderTagSupport } from './renderTagSupport.function';\n/* Used to rewrite props that are functions. When they are called it should cause parent rendering */\nexport function alterProps(props, templater, ownerSupport) {\n function callback(toCall, callWith) {\n return callbackPropOwner(toCall, callWith, templater, ownerSupport);\n }\n const isPropTag = isTagInstance(props);\n const watchProps = isPropTag ? 0 : props;\n const newProps = resetFunctionProps(watchProps, callback);\n return newProps;\n}\nfunction resetFunctionProps(props, callback) {\n if (typeof (props) !== 'object') {\n return props;\n }\n const newProps = props;\n // BELOW: Do not clone because if first argument is object, the memory ref back is lost\n // const newProps = {...props} \n Object.entries(newProps).forEach(([name, value]) => {\n if (value instanceof Function) {\n const original = newProps[name].original;\n if (original) {\n return; // already previously converted\n }\n newProps[name] = (...args) => {\n return newProps[name].toCall(...args); // what gets called can switch over parent state changes\n };\n // Currently, call self but over parent state changes, I may need to call a newer parent tag owner\n newProps[name].toCall = (...args) => callback(value, args);\n newProps[name].original = value;\n return;\n }\n });\n return newProps;\n}\nexport function callbackPropOwner(toCall, callWith, templater, // only used to prevent rendering double\nownerSupport) {\n const renderCount = templater.global.renderCount;\n const callbackResult = toCall(...callWith);\n if (templater.global.renderCount > renderCount) {\n throw new Error('already rendered');\n }\n const lastestOwner = ownerSupport.templater.global.newest;\n const newOwner = renderTagSupport(lastestOwner.tagSupport, true);\n if (newOwner.tagSupport.templater.global.newest != newOwner) {\n throw new Error('newest assignment issue?');\n }\n return callbackResult;\n}\n","/** File largely responsible for reacting to element events, such as onclick */\nimport { renderTagSupport } from \"./renderTagSupport.function\";\nexport function bindSubjectCallback(value, tag) {\n // Is this children? No override needed\n if (value.isChildOverride) {\n return value;\n }\n if (!tag.ownerTag && !tag.tagSupport.templater.global.isApp) {\n throw new Error('no ownerTag issue here');\n }\n const subjectFunction = (element, args) => runTagCallback(value, tag, element, args);\n // link back to original. Mostly used for <div oninit ondestroy> animations\n subjectFunction.tagFunction = value;\n return subjectFunction;\n}\nexport function runTagCallback(value, tag, bindTo, args) {\n const tagSupport = tag.tagSupport;\n const renderCount = tagSupport.templater.global.renderCount;\n const method = value.bind(bindTo);\n const callbackResult = method(...args);\n const sameRenderCount = renderCount === tagSupport.templater.global.renderCount;\n // already rendered OR tag was deleted before event processing\n if (!sameRenderCount || tagSupport.templater.global.deleted) {\n if (callbackResult instanceof Promise) {\n return callbackResult.then(() => {\n return 'promise-no-data-ever'; // tag was deleted during event processing\n });\n }\n return 'no-data-ever'; // already rendered\n }\n renderTagSupport(tagSupport, true);\n if (callbackResult instanceof Promise) {\n return callbackResult.then(() => {\n if (tagSupport.templater.global.deleted) {\n return 'promise-no-data-ever'; // tag was deleted during event processing\n }\n renderTagSupport(tagSupport, true);\n return 'promise-no-data-ever';\n });\n }\n // Caller always expects a Promise\n return 'no-data-ever';\n}\n","import { isTagArray, isTagComponent, isTagInstance } from './isInstance';\nimport { isLikeTags } from './isLikeTags.function';\nimport { destroyTagMemory, destroyTagSupportPast } from './destroyTag.function';\nimport { insertAfter } from './insertAfter.function';\nexport function checkDestroyPrevious(subject, // existing.value is the old value\nnewValue, insertBefore) {\n const arraySubject = subject;\n const wasArray = arraySubject.lastArray;\n // no longer an array\n if (wasArray && !isTagArray(newValue)) {\n const placeholderElm = arraySubject.placeholder;\n delete arraySubject.lastArray;\n delete arraySubject.placeholder;\n insertAfter(insertBefore, placeholderElm);\n wasArray.forEach(({ tag }) => destroyArrayTag(tag, { added: 0, removed: 0 }));\n return 'array';\n }\n const tagSubject = subject;\n const existingTag = tagSubject.tag;\n // no longer tag or component?\n if (existingTag) {\n const isValueTag = isTagInstance(newValue);\n const isSubjectTag = isTagInstance(subject.value);\n if (isSubjectTag && isValueTag) {\n const newTag = newValue;\n // its a different tag now\n if (!isLikeTags(newTag, existingTag)) {\n // put template back down\n restoreTagMarker(existingTag, insertBefore);\n destroyTagMemory(existingTag, tagSubject);\n return 2;\n }\n return false;\n }\n const isValueTagComponent = isTagComponent(newValue);\n if (isValueTagComponent) {\n return false; // its still a tag component\n }\n // put template back down\n restoreTagMarker(existingTag, insertBefore);\n // destroy old component, value is not a component\n destroyTagMemory(existingTag, tagSubject);\n return 'different-tag';\n }\n const displaySubject = subject;\n const hasLastValue = 'lastValue' in displaySubject;\n const lastValue = displaySubject.lastValue; // TODO: we maybe able to use displaySubject.value and remove concept of lastValue\n // was simple value but now something bigger\n if (hasLastValue && lastValue !== newValue) {\n destroySimpleValue(insertBefore, displaySubject);\n return 4;\n }\n return false;\n}\nexport function destroyArrayTag(tag, counts) {\n destroyTagSupportPast(tag.tagSupport);\n tag.destroy({\n stagger: counts.removed++,\n });\n}\nfunction destroySimpleValue(insertBefore, // always a template tag\nsubject) {\n const clone = subject.clone;\n const parent = clone.parentNode;\n // 1 put the template back down\n parent.insertBefore(insertBefore, clone);\n parent.removeChild(clone);\n delete subject.clone;\n delete subject.lastValue;\n}\nexport function restoreTagMarker(existingTag, insertBefore) {\n const global = existingTag.tagSupport.templater.global;\n const placeholderElm = global.placeholder;\n if (placeholderElm) {\n insertAfter(insertBefore, placeholderElm);\n }\n}\n","export function deepClone(obj) {\n return makeDeepClone(obj, new WeakMap());\n}\nfunction makeDeepClone(obj, visited) {\n // If obj is a primitive type or null, return it directly\n if (obj === null || typeof obj !== 'object') {\n return obj;\n }\n // If obj is already visited, return the cloned reference\n if (visited.has(obj)) {\n return visited.get(obj);\n }\n // Handle special cases like Date and RegExp\n if (obj instanceof Date) {\n return new Date(obj);\n }\n if (obj instanceof RegExp) {\n return new RegExp(obj);\n }\n // Create an empty object or array with the same prototype\n const clone = Array.isArray(obj) ? [] : Object.create(Object.getPrototypeOf(obj));\n // Register the cloned object to avoid cyclic references\n visited.set(obj, clone);\n // Clone each property or element of the object or array\n if (Array.isArray(obj)) {\n for (let i = 0; i < obj.length; i++) {\n clone[i] = makeDeepClone(obj[i], visited);\n }\n }\n else {\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n clone[key] = makeDeepClone(obj[key], visited);\n }\n }\n }\n return clone;\n}\nexport function deepEqual(obj1, obj2) {\n return isDeepEqual(obj1, obj2, new WeakMap());\n}\nfunction isDeepEqual(obj1, obj2, visited) {\n if (obj1 === obj2 || isSameFunctions(obj1, obj2)) {\n return true;\n }\n if (typeof obj1 !== 'object' ||\n typeof obj2 !== 'object' ||\n obj1 === null ||\n obj2 === null) {\n return false;\n }\n const keys1 = Object.keys(obj1);\n const keys2 = Object.keys(obj2);\n if (keys1.length !== keys2.length) {\n return false;\n }\n // If obj is already visited, return the cloned reference\n if (visited.has(obj1)) {\n return true;\n }\n // Register the cloned object to avoid cyclic references\n visited.set(obj1, 0);\n for (const key of keys1) {\n const keyFound = keys2.includes(key);\n if (!keyFound || !isDeepEqual(obj1[key], obj2[key], visited)) {\n /*\n if(isSameFunctions(obj1[key], obj2[key])) {\n continue\n }\n */\n return false;\n }\n }\n // Check if obj1 and obj2 are both arrays\n if (Array.isArray(obj1) && Array.isArray(obj2)) {\n if (obj1.length !== obj2.length) {\n return false;\n }\n for (let i = 0; i < obj1.length; i++) {\n if (!isDeepEqual(obj1[i], obj2[i], visited)) {\n return false;\n }\n }\n }\n else if (Array.isArray(obj1) || Array.isArray(obj2)) {\n // One is an array, and the other is not\n return false;\n }\n return true;\n}\nfunction isSameFunctions(fn0, fn1) {\n const bothFunction = fn0 instanceof Function && fn1 instanceof Function;\n return bothFunction && fn0.toString() === fn1.toString();\n}\n","export function destroyTagMemory(tag, subject) {\n const oldTagSupport = tag.tagSupport;\n if (subject != oldTagSupport.subject) {\n throw new Error('fff - subjects do not match');\n }\n delete subject.tag;\n delete oldTagSupport.subject.tag; // TODO: this line maybe not needed\n // must destroy oldest which is tag with elements on stage\n const oldest = oldTagSupport.templater.global.oldest;\n oldest.destroy();\n destroyTagSupportPast(oldTagSupport);\n oldTagSupport.templater.global.context = {};\n}\nexport function destroyTagSupportPast(oldTagSupport) {\n delete oldTagSupport.templater.global.oldest;\n delete oldTagSupport.templater.global.newest;\n}\n","export function elementDestroyCheck(nextSibling, stagger) {\n const onDestroyDoubleWrap = nextSibling.ondestroy;\n if (!onDestroyDoubleWrap) {\n return;\n }\n const onDestroyWrap = onDestroyDoubleWrap.tagFunction;\n if (!onDestroyWrap) {\n return;\n }\n const onDestroy = onDestroyWrap.tagFunction;\n if (!onDestroy) {\n return;\n }\n const event = { target: nextSibling, stagger };\n return onDestroy(event);\n}\n","export function elementInitCheck(nextSibling, counts) {\n const onInitDoubleWrap = nextSibling.oninit;\n if (!onInitDoubleWrap) {\n return counts.added;\n }\n const onInitWrap = onInitDoubleWrap.tagFunction;\n if (!onInitWrap) {\n return counts.added;\n }\n const onInit = onInitWrap.tagFunction;\n if (!onInit) {\n return counts.added;\n }\n const event = { target: nextSibling, stagger: counts.added };\n onInit(event);\n return ++counts.added;\n}\n","export class TagError extends Error {\n details;\n constructor(message, errorCode, details = {}) {\n super(message);\n this.name = TagError.name;\n this.details = { ...details, errorCode };\n }\n}\nexport class ArrayNoKeyError extends TagError {\n constructor(message, details) {\n super(message, 'array-no-key-error', details);\n this.name = ArrayNoKeyError.name;\n }\n}\nexport class StateMismatchError extends TagError {\n constructor(message, details) {\n super(message, 'state-mismatch-error', details);\n this.name = StateMismatchError.name;\n }\n}\nexport class SyncCallbackError extends TagError {\n constructor(message, details) {\n super(message, 'sync-callback-error', details);\n this.name = SyncCallbackError.name;\n }\n}\n","import { deepEqual } from \"./deepFunctions\";\nexport function hasTagSupportChanged(oldTagSupport, newTagSupport, newTemplater) {\n const sameSupport = oldTagSupport === newTagSupport;\n const samePropConfig = oldTagSupport.propsConfig === newTagSupport.propsConfig;\n // const sameProps = oldTagSupport.propsConfig.latest === newTagSupport.propsConfig.latest\n if (sameSupport) {\n throw new Error('sameSupport - 22');\n }\n if (samePropConfig) {\n throw new Error('samePropConfig - 22');\n }\n if (newTagSupport.templater.isTag || oldTagSupport.templater.isTag || newTemplater.isTag) {\n throw new Error('trying to compare a basic tag');\n }\n const latestProps = newTemplater.props; // newTagSupport.propsConfig.latest\n const pastCloneProps = oldTagSupport.propsConfig.latestCloned;\n const propsChanged = hasPropChanges(latestProps, pastCloneProps);\n // if no changes detected, no need to continue to rendering further tags\n if (propsChanged) {\n return propsChanged;\n }\n const kidsChanged = hasKidsChanged(oldTagSupport, newTagSupport);\n // we already know props didn't change and if kids didn't either, than don't render\n return kidsChanged;\n}\nexport function hasPropChanges(props, // natural props\npastCloneProps) {\n /*\n const isCommonEqual = props === undefined && props === compareToProps\n if(isCommonEqual) {\n return false\n }\n */\n let castedProps = props;\n let castedPastProps = pastCloneProps;\n // check all prop functions match\n if (typeof (props) === 'object') {\n if (!pastCloneProps) {\n return 3;\n }\n castedProps = { ...props };\n castedPastProps = { ...(pastCloneProps || {}) };\n const allFunctionsMatch = Object.entries(castedProps).every(([key, value]) => {\n let compare = castedPastProps[key];\n if (!(value instanceof Function)) {\n return 4; // this will be checked in deepEqual\n }\n if (!(compare instanceof Function)) {\n return false; // its a function now but was not before\n }\n // ensure we are comparing apples to apples as function get wrapped\n if (compare.original) {\n compare = compare.original;\n }\n const original = value.original;\n if (original) {\n value = value.original;\n }\n if (value.toString() !== compare.toString()) {\n return false; // both are function but not the same\n }\n delete castedProps[key]; // its a function and not needed to be compared\n delete castedPastProps[key]; // its a function and not needed to be compared\n return 5;\n });\n if (!allFunctionsMatch) {\n return 6; // a change has been detected by function comparisons\n }\n }\n const isEqual = deepEqual(castedPastProps, castedProps);\n return isEqual ? false : 7; // if equal then no changes\n}\nexport function hasKidsChanged(oldTagSupport, newTagSupport) {\n const oldCloneKidValues = oldTagSupport.propsConfig.lastClonedKidValues;\n const newClonedKidValues = newTagSupport.propsConfig.lastClonedKidValues;\n const everySame = oldCloneKidValues.every((set, index) => {\n const x = newClonedKidValues[index];\n return set.every((item, index) => item === x[index]);\n });\n return everySame ? false : 9;\n}\n","import { Tag } from \"./Tag.class\";\nexport function html(strings, ...values) {\n return new Tag(strings, values);\n}\n","export function inputAttribute(name, value, element) {\n const names = name.split('.');\n // style.position = \"absolute\"\n if (names[0] === 'style') {\n element.style[names[1]] = value;\n }\n // Example: class.width-full = \"true\"\n if (names[0] === 'class') {\n names.shift();\n if (value) {\n names.forEach(name => element.classList.add(name));\n }\n else {\n names.forEach(name => element.classList.remove(name));\n }\n return;\n }\n}\n","// Function to insert element after reference element\nexport function insertAfter(newNode, referenceNode) {\n const parentNode = referenceNode.parentNode;\n parentNode.insertBefore(newNode, referenceNode.nextSibling);\n}\n","import { processAttribute } from \"./processAttribute.function\";\nfunction howToSetAttribute(element, name, value) {\n element.setAttribute(name, value);\n}\nfunction howToSetInputValue(element, name, value) {\n element[name] = value;\n}\nexport function interpolateAttributes(child, scope, ownerTag) {\n const attrNames = child.getAttributeNames();\n let howToSet = howToSetAttribute;\n attrNames.forEach(attrName => {\n if (child.nodeName === 'INPUT' && attrName === 'value') {\n howToSet = howToSetInputValue;\n }\n const value = child.getAttribute(attrName);\n processAttribute(attrName, value, child, scope, ownerTag, howToSet);\n howToSet = howToSetAttribute; // put back\n });\n}\n","import { interpolateTemplate } from \"./interpolateTemplate\";\nexport function interpolateContentTemplates(element, context, tag, options, children) {\n if (!children || element.tagName === 'TEMPLATE') {\n return { clones: [], tagComponents: [] }; // done\n }\n // counting for animation stagger computing\n const counts = options.counts;\n const clones = [];\n const tagComponents = [];\n const childArray = new Array(...children);\n childArray.forEach(child => {\n const { clones: nextClones, tagComponent } = interpolateTemplate(child, context, tag, counts, options);\n clones.push(...nextClones);\n if (tagComponent) {\n tagComponents.push(tagComponent);\n return;\n }\n if (child.children) {\n const nextKids = new Array(...child.children);\n nextKids.forEach((subChild, index) => {\n // IF <template end /> its a variable to be processed\n if (isRenderEndTemplate(subChild)) {\n const { tagComponent } = interpolateTemplate(subChild, context, tag, counts, options);\n if (tagComponent) {\n tagComponents.push(tagComponent);\n }\n }\n const { clones: nextClones, tagComponents: nextTagComponent } = interpolateContentTemplates(subChild, context, tag, options, subChild.children);\n clones.push(...nextClones);\n tagComponents.push(...nextTagComponent);\n });\n }\n });\n return { clones, tagComponents };\n}\nfunction isRenderEndTemplate(child) {\n const isTemplate = child.tagName === 'TEMPLATE';\n return isTemplate &&\n child.getAttribute('interpolate') !== undefined &&\n child.getAttribute('end') !== undefined;\n}\n","import { interpolateAttributes } from \"./interpolateAttributes\";\nimport { interpolateToTemplates } from \"./interpolations\";\nimport { interpolateContentTemplates } from \"./interpolateContentTemplates\";\nimport { escapeSearch, variablePrefix } from \"./Tag.class\";\n/** Review elements within an element */\nexport function interpolateElement(container, // element containing innerHTML to review interpolations\ncontext, // variables used to evaluate\ninterpolatedTemplates, tagOwner, options) {\n const clones = [];\n const tagComponents = [];\n const result = interpolatedTemplates.interpolation;\n const template = container.children[0];\n const children = template.content.children;\n if (result.keys.length) {\n const { clones: nextClones, tagComponents: nextTagComponents } = interpolateContentTemplates(container, context, tagOwner, options, children);\n clones.push(...nextClones);\n tagComponents.push(...nextTagComponents);\n }\n interpolateAttributes(container, context, tagOwner);\n processChildrenAttributes(children, context, tagOwner);\n return { clones, tagComponents };\n}\nfunction processChildrenAttributes(children, context, ownerTag) {\n new Array(...children).forEach(child => {\n interpolateAttributes(child, context, ownerTag);\n if (child.children) {\n processChildrenAttributes(child.children, context, ownerTag);\n }\n });\n}\nexport function interpolateString(string) {\n const result = interpolateToTemplates(string);\n result.string = result.string.replace(escapeSearch, variablePrefix);\n return result;\n}\n","import { variablePrefix } from \"./Tag.class\";\nimport { elementInitCheck } from \"./elementInitCheck\";\nimport { processSubjectValue } from \"./processSubjectValue.function\";\nimport { isTagArray, isTagComponent } from \"./isInstance\";\nimport { scanTextAreaValue } from \"./scanTextAreaValue.function\";\nimport { updateExistingValue } from \"./updateExistingValue.function\";\nexport function interpolateTemplate(insertBefore, // <template end interpolate /> (will be removed)\ncontext, // variable scope of {`__tagvar${index}`:'x'}\nownerTag, // Tag class\ncounts, // used for animation stagger computing\noptions) {\n // TODO: THe clones array is useless here\n const clones = [];\n if (!insertBefore.hasAttribute('end')) {\n return { clones }; // only care about <template end>\n }\n const variableName = insertBefore.getAttribute('id');\n if (variableName?.substring(0, variablePrefix.length) !== variablePrefix) {\n return { clones }; // ignore, not a tagVar\n }\n const existingSubject = context[variableName];\n const isDynamic = isTagComponent(existingSubject.value) || isTagArray(existingSubject.value);\n // process dynamics later\n if (isDynamic) {\n return {\n clones,\n tagComponent: {\n variableName,\n ownerTag,\n subject: existingSubject,\n insertBefore\n }\n };\n }\n let isForceElement = options.forceElement;\n subscribeToTemplate(insertBefore, existingSubject, ownerTag, counts, { isForceElement });\n return { clones };\n}\nexport function subscribeToTemplate(insertBefore, subject, ownerTag, counts, // used for animation stagger computing\n{ isForceElement }) {\n let called = false;\n const callback = (value) => {\n // const orgInsert = insertBefore\n /*\n const clone = (subject as DisplaySubject).clone\n if(clone && clone.parentNode) {\n insertBefore = clone\n }\n */\n if (called) {\n updateExistingValue(subject, value, ownerTag, insertBefore);\n return;\n }\n if (!insertBefore.parentNode) {\n throw new Error('no insert before parent node - 3');\n }\n processSubjectValue(value, subject, insertBefore, ownerTag, {\n counts: { ...counts },\n forceElement: isForceElement,\n });\n if (isForceElement) {\n isForceElement = false; // only can happen once\n }\n // ownerTag.clones.push(...clones)\n // ownerTag.clones.push(...nextClones)\n // clones.push(...nextClones)\n called = true;\n };\n const sub = subject.subscribe(callback);\n ownerTag.tagSupport.templater.global.subscriptions.push(sub);\n}\nexport function afterElmBuild(elm, options, context, ownerTag) {\n if (!elm.getAttribute) {\n return;\n }\n const tagName = elm.nodeName; // elm.tagName\n if (tagName === 'TEXTAREA') {\n scanTextAreaValue(elm, context, ownerTag);\n }\n let diff = options.counts.added;\n diff = elementInitCheck(elm, options.counts) - diff;\n if (elm.children) {\n new Array(...elm.children).forEach((child, index) => {\n const subOptions = {\n ...options,\n counts: options.counts,\n };\n return afterElmBuild(child, subOptions, context, ownerTag);\n });\n }\n}\n","// support arrow functions in attributes\nexport const interpolateReplace = /(?:<[^>]*?(?:(?:\\s+\\w+(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^>\\s]+)))*\\s*)\\/?>)|({__tagvar[^}]+})/g;\n/** replaces ${x} with <template id=\"x-start\"></template><template id=\"x-end\"></template> */\nexport function interpolateToTemplates(template) {\n const keys = [];\n const string = template.replace(interpolateReplace, (match, expression) => {\n if (match.startsWith('<')) {\n // If the match is an HTML tag, don't replace\n return match;\n }\n const noBraces = expression.substring(1, expression.length - 1);\n const id = noBraces;\n const name = 'template-' + template.length;\n keys.push(id);\n return `<template interpolate end id=\"${id}\" name=\"${name}\"></template>`;\n });\n return { string, keys };\n}\n","export function isTagComponent(value) {\n return value?.isTemplater === true;\n}\nexport function isTagInstance(tag) {\n return tag?.isTag === true;\n}\nexport function isSubjectInstance(subject) {\n return (subject?.isSubject === true || subject?.subscribe) ? true : false; // subject?.isSubject === true || \n}\nexport function isTagArray(value) {\n return value instanceof Array && value.every(x => isTagInstance(x));\n}\n","export function isLikeTags(tag0, tag1) {\n if (tag0.strings.length !== tag1.strings.length) {\n return false;\n }\n const everyStringMatched = tag0.strings.every((string, index) => tag1.strings[index] === string);\n if (!everyStringMatched) {\n return false;\n }\n const valuesLengthsMatch = tag0.values.length === tag1.values.length;\n if (!valuesLengthsMatch) {\n return false;\n }\n const allVarsMatch = tag1.values.every((value, index) => {\n const compareTo = tag0.values[index];\n const isFunctions = value instanceof Function && compareTo instanceof Function;\n if (isFunctions) {\n const stringMatch = value.toString() === compareTo.toString();\n if (stringMatch) {\n return true;\n }\n return false;\n }\n return true; // deepEqual(value, compareTo)\n });\n if (allVarsMatch) {\n return true;\n }\n return false;\n}\n","import { inputAttribute } from './inputAttribute';\nimport { isSubjectInstance } from './isInstance';\nimport { bindSubjectCallback } from './bindSubjectCallback.function';\nconst startRegX = /^\\s*{__tagvar/;\nconst endRegX = /}\\s*$/;\nfunction isTagVar(value) {\n return value && value.search(startRegX) >= 0 && value.search(endRegX) >= 0;\n}\nexport function processAttribute(attrName, value, child, scope, ownerTag, howToSet) {\n if (isTagVar(value)) {\n return processScopedNameValueAttr(attrName, value, child, scope, ownerTag, howToSet);\n }\n if (isTagVar(attrName)) {\n const contextValueSubject = getContextValueByVarString(scope, attrName);\n let lastValue;\n // the above callback gets called immediately since its a ValueSubject()\n const sub = contextValueSubject.subscribe((value) => {\n processNameOnlyAttr(value, lastValue, child, ownerTag, howToSet);\n lastValue = value;\n });\n ownerTag.tagSupport.templater.global.subscriptions.push(sub); // this is where unsubscribe is picked up\n child.removeAttribute(attrName);\n return;\n }\n // Non dynamic\n const isSpecial = isSpecialAttr(attrName);\n if (isSpecial) {\n return inputAttribute(attrName, value, child);\n }\n}\nfunction processScopedNameValueAttr(attrName, value, // {__tagVarN}\nchild, scope, ownerTag, howToSet) {\n // get the code inside the brackets like \"variable0\" or \"{variable0}\"\n const result = getContextValueByVarString(scope, value);\n return processNameValueAttr(attrName, result, child, ownerTag, howToSet);\n}\nfunction getContextValueByVarString(scope, value) {\n const code = value.replace('{', '').split('').reverse().join('').replace('}', '').split('').reverse().join('');\n return scope[code];\n}\nfunction processNameOnlyAttr(attrValue, lastValue, child, ownerTag, howToSet) {\n if (lastValue && lastValue != attrValue) {\n if (typeof (lastValue) === 'string') {\n child.removeAttribute(lastValue);\n }\n else if (lastValue instanceof Object) {\n Object.entries(lastValue).forEach(([name]) => child.removeAttribute(name));\n }\n }\n if (typeof (attrValue) === 'string') {\n if (!attrValue.length) {\n return;\n }\n processNameValueAttr(attrValue, '', child, ownerTag, howToSet);\n return;\n }\n if (attrValue instanceof Object) {\n Object.entries(attrValue).forEach(([name, value]) => processNameValueAttr(name, value, child, ownerTag, howToSet));\n return;\n }\n}\nfunction processNameValueAttr(attrName, result, child, ownerTag, howToSet) {\n const isSpecial = isSpecialAttr(attrName);\n // attach as callback?\n if (result instanceof Function) {\n const action = function (...args) {\n const result2 = result(child, args);\n return result2;\n };\n child[attrName].action = action;\n // child.addEventListener(attrName, action)\n }\n // Most every variable comes in here since everything is made a ValueSubject\n if (isSubjectInstance(result)) {\n child.removeAttribute(attrName);\n const callback = (newAttrValue) => {\n if (newAttrValue instanceof Function) {\n newAttrValue = bindSubjectCallback(newAttrValue, ownerTag);\n }\n return processAttributeSubjectValue(newAttrValue, child, attrName, isSpecial, howToSet);\n };\n // 🗞️ Subscribe. Above callback called immediately since its a ValueSubject()\n const sub = result.subscribe(callback);\n // Record subscription for later unsubscribe when element destroyed\n ownerTag.tagSupport.templater.global.subscriptions.push(sub);\n return;\n }\n howToSet(child, attrName, result);\n // child.setAttribute(attrName, result.value)\n return;\n}\nfunction processAttributeSubjectValue(newAttrValue, child, attrName, isSpecial, howToSet) {\n if (newAttrValue instanceof Function) {\n const fun = function (...args) {\n return newAttrValue(child, args);\n };\n // access to original function\n fun.tagFunction = newAttrValue;\n child[attrName] = fun;\n return;\n }\n if (isSpecial) {\n inputAttribute(attrName, newAttrValue, child);\n return;\n }\n if (newAttrValue) {\n howToSet(child, attrName, newAttrValue);\n return;\n }\n const isDeadValue = [undefined, false, null].includes(newAttrValue);\n if (isDeadValue) {\n child.removeAttribute(attrName);\n return;\n }\n // value is 0\n howToSet(child, attrName, newAttrValue);\n}\n/** Looking for (class | style) followed by a period */\nfunction isSpecialAttr(attrName) {\n return attrName.search(/^(class|style)(\\.)/) >= 0;\n}\n","import { ValueSubject } from './subject/ValueSubject';\nimport { isSubjectInstance, isTagComponent, isTagInstance } from './isInstance';\nexport function processNewValue(hasValue, value, ownerTag) {\n if (isTagComponent(value)) {\n const tagSubject = new ValueSubject(value);\n return tagSubject;\n }\n if (value instanceof Function) {\n // return getSubjectFunction(value, ownerTag)\n return new ValueSubject(value);\n }\n if (!hasValue) {\n return; // more strings than values, stop here\n }\n if (isTagInstance(value)) {\n value.ownerTag = ownerTag;\n if (ownerTag.childTags.find(x => x === value)) {\n throw new Error('about to reattach tag already present - 2');\n }\n return new ValueSubject(value);\n }\n if (isSubjectInstance(value)) {\n return value; // its already a value subject\n }\n return new ValueSubject(value);\n}\n","import { updateBeforeTemplate } from './updateBeforeTemplate.function';\nexport function processRegularValue(value, subject, // could be tag via subject.tag\ninsertBefore) {\n subject.insertBefore = insertBefore;\n const before = subject.clone || insertBefore; // Either the template is on the doc OR its the first element we last put on doc\n // matches but also was defined at some point\n if (subject.lastValue === value && 'lastValue' in subject) {\n return; // no need to update display, its the same\n }\n subject.lastValue = value;\n // Processing of regular values\n const clone = updateBeforeTemplate(value, before);\n subject.clone = clone; // remember single element put down, for future updates\n}\n","import { renderWithSupport } from './TemplaterResult.class';\nimport { setUse } from './state';\nimport { processTagResult } from './processTagResult.function';\nimport { TagSupport } from './TagSupport.class';\nexport function processSubjectComponent(templater, subject, insertBefore, ownerTag, options) {\n // Check if function component is wrapped in a tag() call\n // TODO: This below check not needed in production mode\n if (templater.tagged !== true) {\n const original = templater.wrapper.original;\n let name = original.name || original.constructor?.name;\n if (name === 'Function') {\n name = undefined;\n }\n const label = name || original.toString().substring(0, 120);\n const error = new Error(`Not a tag component. Wrap your function with tag(). Example tag(props => html\\`\\`) on component:\\n\\n${label}\\n\\n`);\n throw error;\n }\n templater.tagSupport = new TagSupport(ownerTag.tagSupport, templater, subject);\n // templater.oldest = subject.tag?.tagSupport.oldest || templater.oldest\n if (insertBefore.nodeName != 'TEMPLATE') {\n throw new Error('9');\n }\n templater.global.insertBefore = insertBefore;\n let retag = subject.tag;\n const providers = setUse.memory.providerConfig;\n providers.ownerTag = ownerTag;\n const isRedraw = !retag || options.forceElement;\n if (isRedraw) {\n retag = redrawSubjectComponent(templater, subject, retag, ownerTag, insertBefore);\n }\n processTagResult(retag, subject, // The element set here will be removed from document. Also result.tag will be added in here\n insertBefore, // <template end interpolate /> (will be removed)\n options);\n return retag;\n}\nfunction redrawSubjectComponent(templater, subject, retag, ownerTag, insertBefore) {\n const preClones = ownerTag.clones.map(clone => clone);\n retag = renderWithSupport(templater.tagSupport, subject.tag, // existing tag\n subject, ownerTag);\n if (retag.tagSupport.templater.global.newest != retag) {\n throw new Error('mismatch result newest');\n }\n templater.global.newest = retag;\n if (ownerTag.clones.length > preClones.length) {\n const myClones = ownerTag.clones.filter(fClone => !preClones.find(clone => clone === fClone));\n retag.clones.push(...myClones);\n if (myClones.find(x => x === insertBefore)) {\n throw new Error('way back here we add marker');\n }\n }\n if (ownerTag.childTags.find(x => x === retag)) {\n throw new Error('about to reattach tag already present');\n }\n ownerTag.childTags.push(retag);\n return retag;\n}\n","import { processSubjectComponent } from './processSubjectComponent.function';\nimport { isTagArray, isTagComponent, isTagInstance } from './isInstance';\nimport { processTagArray } from './processTagArray';\nimport { processRegularValue } from './processRegularValue.function';\nimport { processTag } from './processTag.function';\nvar ValueTypes;\n(function (ValueTypes) {\n ValueTypes[\"tag\"] = \"tag\";\n ValueTypes[\"tagArray\"] = \"tag-array\";\n ValueTypes[\"tagComponent\"] = \"tag-component\";\n ValueTypes[\"value\"] = \"value\";\n})(ValueTypes || (ValueTypes = {}));\nfunction getValueType(value) {\n if (isTagComponent(value)) {\n return ValueTypes.tagComponent;\n }\n if (isTagInstance(value)) {\n return ValueTypes.tag;\n }\n if (isTagArray(value)) {\n return ValueTypes.tagArray;\n }\n return ValueTypes.value;\n}\nexport function processSubjectValue(value, subject, // could be tag via result.tag\ninsertBefore, // <template end interpolate /> (will be removed)\nownerTag, // owner\noptions) {\n const valueType = getValueType(value);\n switch (valueType) {\n case ValueTypes.tag:\n processTag(value, subject, insertBefore, ownerTag);\n return;\n case ValueTypes.tagArray:\n return processTagArray(subject, value, insertBefore, ownerTag, options);\n case ValueTypes.tagComponent:\n processSubjectComponent(value, subject, insertBefore, ownerTag, options);\n return;\n }\n processRegularValue(value, subject, insertBefore);\n}\n","import { isTagInstance } from './isInstance';\nimport { TagSupport } from './TagSupport.class';\nimport { ValueSubject } from './subject';\n/** Could be a regular tag or a component. Both are Tag.class */\nexport function processTag(tag, subject, // could be tag via result.tag\ninsertBefore, ownerTag) {\n // first time seeing this tag?\n if (!tag.tagSupport) {\n if (!isTagInstance(tag)) {\n throw new Error('issue non-tag here');\n }\n applyFakeTemplater(tag, ownerTag, subject);\n if (ownerTag.childTags.find(x => x === tag)) {\n throw new Error('about to reattach tag already present - 5');\n }\n ownerTag.childTags.push(tag);\n }\n tag.ownerTag = ownerTag;\n if (insertBefore.tagName !== 'TEMPLATE') {\n throw new Error(`processTag.function.ts - insertBefore is not TEMPLATE ${insertBefore.tagName}`);\n }\n tag.buildBeforeElement(insertBefore, {\n counts: { added: 0, removed: 0 },\n forceElement: true,\n });\n}\nexport function applyFakeTemplater(tag, ownerTag, subject) {\n if (!ownerTag) {\n throw new Error('no owner error');\n }\n const fakeTemplater = getFakeTemplater();\n tag.tagSupport = new TagSupport(ownerTag.tagSupport, fakeTemplater, // the template is provided via html`` call\n subject);\n fakeTemplater.global.oldest = tag;\n fakeTemplater.global.newest = tag;\n fakeTemplater.tagSupport = tag.tagSupport;\n // asking me to render will cause my parent to render\n tag.ownerTag = ownerTag;\n}\nfunction getFakeTemplater() {\n return {\n global: {\n renderCount: 0,\n providers: [],\n context: {},\n subscriptions: [],\n deleted: false,\n newestTemplater: {},\n },\n children: new ValueSubject([]), // no children\n props: {},\n isTag: true,\n isTemplater: false,\n tagged: false,\n wrapper: (() => undefined),\n tagSupport: {},\n };\n}\n","import { ValueSubject } from './subject/ValueSubject';\nimport { ArrayNoKeyError } from './errors';\nimport { destroyArrayTag } from './checkDestroyPrevious.function';\nimport { applyFakeTemplater } from './processTag.function';\nexport function processTagArray(subject, value, // arry of Tag classes\ninsertBefore, // <template end interpolate />\nownerTag, options) {\n const clones = ownerTag.clones; // []\n let lastArray = subject.lastArray = subject.lastArray || [];\n if (!subject.placeholder) {\n setPlaceholderElm(insertBefore, subject);\n }\n const runtimeInsertBefore = subject.placeholder; // || insertBefore\n let removed = 0;\n /** 🗑️ remove previous items first */\n lastArray = subject.lastArray = subject.lastArray.filter((item, index) => {\n const newLength = value.length - 1;\n const at = index - removed;\n const lessLength = newLength < at;\n const subTag = value[index - removed];\n const subArrayValue = subTag?.memory.arrayValue;\n const tag = item.tag;\n const destroyItem = lessLength || !areLikeValues(subArrayValue, tag.memory.arrayValue);\n if (destroyItem) {\n const last = lastArray[index];\n const tag = last.tag;\n destroyArrayTag(tag, options.counts);\n last.deleted = true;\n ++removed;\n ++options.counts.removed;\n return false;\n }\n return true;\n });\n value.forEach((subTag, index) => {\n const previous = lastArray[index];\n const previousSupport = previous?.tag.tagSupport;\n const fakeSubject = new ValueSubject({});\n applyFakeTemplater(subTag, ownerTag, fakeSubject);\n if (previousSupport) {\n subTag.tagSupport.templater.global = previousSupport.templater.global;\n previousSupport.templater.global.newest = subTag;\n }\n // check for html``.key()\n const keySet = 'arrayValue' in subTag.memory;\n if (!keySet) {\n const details = {\n template: subTag.getTemplate().string,\n array: value,\n ownerTagContent: ownerTag.lastTemplateString,\n };\n const message = 'Use html`...`.key(item) instead of html`...` to template an Array';\n console.error(message, details);\n const err = new ArrayNoKeyError(message, details);\n throw err;\n }\n const couldBeSame = lastArray.length > index;\n if (couldBeSame) {\n const prevSupport = previous.tag.tagSupport;\n const prevGlobal = prevSupport.templater.global;\n const isSame = areLikeValues(previous.tag.memory.arrayValue, subTag.memory.arrayValue);\n if (isSame) {\n subTag.tagSupport = subTag.tagSupport || prevSupport;\n const oldest = prevGlobal.oldest;\n oldest.updateByTag(subTag);\n return [];\n }\n // TODO: should not get here?\n processAddTagArrayItem(runtimeInsertBefore, subTag, index, options, lastArray);\n throw new Error('item should be back');\n // return [] // removed: item should have been previously deleted and will be added back\n }\n processAddTagArrayItem(runtimeInsertBefore, subTag, index, options, lastArray);\n ownerTag.childTags.push(subTag);\n });\n return clones;\n}\nfunction setPlaceholderElm(insertBefore, subject) {\n if (insertBefore.nodeName !== 'TEMPLATE') {\n subject.placeholder = insertBefore;\n return;\n }\n const placeholder = subject.placeholder = document.createTextNode('');\n const parentNode = insertBefore.parentNode;\n parentNode.insertBefore(placeholder, insertBefore);\n parentNode.removeChild(insertBefore);\n}\nfunction processAddTagArrayItem(before, subTag, index, options, lastArray) {\n const lastValue = {\n tag: subTag, index\n };\n // Added to previous array\n lastArray.push(lastValue);\n const counts = {\n added: options.counts.added + index,\n removed: options.counts.removed,\n };\n if (!before.parentNode) {\n throw new Error('issue adding array item');\n }\n const newTempElm = document.createElement('template');\n before.parentNode.insertBefore(newTempElm, before);\n subTag.buildBeforeElement(newTempElm, // before,\n { counts, forceElement: options.forceElement });\n}\n/** compare two values. If both values are arrays then the items will be compared */\nfunction areLikeValues(valueA, valueB) {\n if (valueA === valueB) {\n return true;\n }\n const bothArrays = valueA instanceof Array && valueB instanceof Array;\n const matchLengths = bothArrays && valueA.length == valueB.length;\n if (matchLengths) {\n return valueA.every((item, index) => item == valueB[index]);\n }\n return false;\n}\n","export function processTagResult(tag, subject, // used for recording past and current value\ninsertBefore, // <template end interpolate />\n{ counts, forceElement, }) {\n if (!insertBefore.parentNode) {\n throw new Error(`before here processTagResult ${insertBefore.nodeName}`);\n }\n // *if appears we already have seen\n const subjectTag = subject;\n const existingTag = subjectTag.tag;\n const previousTag = existingTag?.tagSupport.templater.global.oldest || undefined; // || tag.tagSupport.oldest // subjectTag.tag\n const justUpdate = previousTag; // && !forceElement\n if (previousTag && justUpdate) {\n /*\n const areLike = previousTag.isLikeTag(tag)\n \n // are we just updating an if we already had?\n if(areLike) {\n return processTagResultUpdate(tag, subjectTag, previousTag)\n }\n */\n return processTagResultUpdate(tag, subjectTag, previousTag);\n }\n /*\n if(insertBefore.nodeName !== 'TEMPLATE') {\n throw new Error(`processTagResult.function.ts insertBefore is not template ${insertBefore.nodeName}`)\n }\n */\n tag.buildBeforeElement(insertBefore, {\n counts,\n forceElement,\n });\n}\nfunction processTagResultUpdate(tag, subject, // used for recording past and current value\npreviousTag) {\n // components\n if (subject instanceof Function) {\n const newTag = subject(previousTag.tagSupport);\n previousTag.updateByTag(newTag);\n subject.tag = newTag;\n return;\n }\n previousTag.updateByTag(tag);\n subject.tag = tag;\n return;\n}\n","export function buildClones(temporary, insertBefore) {\n const clones = [];\n const template = temporary.children[0];\n let nextSibling = template.content.firstChild;\n while (nextSibling) {\n const nextNextSibling = nextSibling.nextSibling;\n buildSibling(nextSibling, insertBefore);\n clones.push(nextSibling);\n nextSibling = nextNextSibling;\n }\n return clones;\n}\nfunction buildSibling(nextSibling, insertBefore) {\n const parentNode = insertBefore.parentNode;\n parentNode.insertBefore(nextSibling, insertBefore);\n}\n","import { providersChangeCheck } from './state/provider.utils';\nimport { renderWithSupport } from './TemplaterResult.class';\nimport { isLikeTags } from './isLikeTags.function';\n/** Returns true when rendering owner is not needed. Returns false when rendering owner should occur */\nexport function renderExistingTag(oldestTag, // existing tag already there\nnewTemplater, tagSupport, subject) {\n const tag = subject.tag;\n newTemplater.global = tag.tagSupport.templater.global;\n if (!oldestTag.hasLiveElements) {\n throw new Error('1080 - should have live elements');\n }\n const preRenderCount = tagSupport.templater.global.renderCount;\n providersChangeCheck(oldestTag);\n // When the providers were checked, a render to myself occurred and I do not need to re-render again\n const latestTag = tagSupport.templater.global.newest;\n if (preRenderCount !== tagSupport.templater.global.renderCount) {\n oldestTag.updateByTag(latestTag);\n return latestTag;\n }\n const oldTemplater = tagSupport.templater || newTemplater;\n const toRedrawTag = subject.tag || oldTemplater.global.newest || oldTemplater.global.oldest; // hmmmmmm, why not newest?\n const redraw = renderWithSupport(newTemplater.tagSupport, toRedrawTag, subject, oldestTag.ownerTag);\n const oldest = tagSupport.templater.global.oldest || oldestTag;\n redraw.tagSupport.templater.global.oldest = oldest;\n if (isLikeTags(latestTag, redraw)) {\n subject.tag = redraw;\n oldest.updateByTag(redraw);\n }\n return redraw;\n}\n","import { deepEqual } from './deepFunctions';\nimport { isTagInstance } from './isInstance';\nimport { renderExistingTag } from './renderExistingTag.function';\n/** Main function used by all other callers to render/update display of a tag component */\nexport function renderTagSupport(tagSupport, renderUp) {\n const global = tagSupport.templater.global;\n if (isTagInstance(tagSupport.templater)) {\n const newTag = global.newest;\n const ownerTag = newTag.ownerTag;\n ++global.renderCount;\n return renderTagSupport(ownerTag.tagSupport, true);\n }\n // const oldTagSetup = this\n const subject = tagSupport.subject;\n const templater = tagSupport.templater; // oldTagSetup.templater // templater\n const subjectTag = subject.tag;\n const newest = subjectTag?.tagSupport.templater.global.newest;\n let ownerTag;\n let selfPropChange = false;\n const shouldRenderUp = renderUp && newest;\n if (shouldRenderUp) {\n ownerTag = newest.ownerTag;\n if (ownerTag) {\n const nowProps = templater.props;\n const latestProps = newest.tagSupport.propsConfig.latestCloned;\n selfPropChange = !deepEqual(nowProps, latestProps);\n }\n }\n const useTagSupport = global.newest?.tagSupport; // oldTagSetup\n if (!templater.global.oldest) {\n throw new Error('already causing trouble');\n }\n const tag = renderExistingTag(templater.global.oldest, templater, useTagSupport, subject);\n const renderOwner = ownerTag && selfPropChange;\n if (renderOwner) {\n const ownerTagSupport = ownerTag.tagSupport;\n renderTagSupport(ownerTagSupport, true);\n return tag;\n }\n return tag;\n}\n","import { processAttribute } from './processAttribute.function';\nconst search = new RegExp('\\\\s*<template interpolate end id=\"__tagvar(\\\\d{1,4})\"([^>]*)></template>(\\\\s*)');\nexport function scanTextAreaValue(textarea, context, ownerTag) {\n const value = textarea.value;\n if (value.search(search) >= 0) {\n const match = value.match(/__tagvar(\\d{1,4})/);\n const token = match ? match[0] : '';\n const dynamic = '{' + token + '}';\n textarea.value = '';\n textarea.setAttribute('text-var-value', dynamic);\n const howToSet = (_elm, _name, value) => textarea.value = value;\n processAttribute('text-var-value', dynamic, // realValue, // context[token].value,\n textarea, context, ownerTag, howToSet);\n }\n}\n","import { setUse } from \"./setUse.function\";\nimport { getStateValue } from \"./state.utils\";\nimport { renderTagSupport } from \"../renderTagSupport.function\";\nimport { SyncCallbackError } from \"../errors\";\nlet innerCallback = (callback) => (...args) => {\n throw new SyncCallbackError('Callback function was called immediately in sync and must instead be call async');\n};\nexport const callbackMaker = () => innerCallback;\nconst originalGetter = innerCallback; // callbackMaker\nsetUse({\n beforeRender: (tagSupport) => initMemory(tagSupport),\n beforeRedraw: (tagSupport) => initMemory(tagSupport),\n afterRender: (_tagSupport) => {\n innerCallback = originalGetter; // prevent crossing callbacks with another tag\n },\n});\nfunction updateState(stateFrom, stateTo) {\n stateFrom.forEach((state, index) => {\n const fromValue = getStateValue(state);\n const callback = stateTo[index].callback;\n if (callback) {\n callback(fromValue); // set the value\n }\n stateTo[index].lastValue = fromValue; // record the value\n });\n}\nfunction initMemory(tagSupport) {\n const oldState = setUse.memory.stateConfig.array;\n innerCallback = (callback) => {\n const trigger = (...args) => triggerStateUpdate(tagSupport, callback, oldState, ...args);\n return trigger;\n };\n}\nfunction triggerStateUpdate(tagSupport, callback, oldState, ...args) {\n const state = tagSupport.memory.state;\n const newest = state.newest;\n // ensure that the oldest has the latest values first\n updateState(newest, oldState);\n // run the callback\n const promise = callback(...args);\n // send the oldest state changes into the newest\n updateState(oldState, newest);\n renderTagSupport(tagSupport, false);\n if (promise instanceof Promise) {\n promise.finally(() => {\n // send the oldest state changes into the newest\n updateState(oldState, newest);\n renderTagSupport(tagSupport, false);\n });\n }\n}\n","export * from \"./watch.function\";\nexport { setUse } from \"./setUse.function\";\nexport { state } from \"./state.function\";\nexport { letState } from \"./letState.function\";\nexport { setProp } from \"./setProp.function\";\nexport { providers } from \"./providers\";\nexport * from \"./callbackMaker.function\";\nexport * from \"./onInit\";\nexport * from \"./onDestroy\";\n","import { getStateValue } from './state.utils';\nimport { setUse } from './setUse.function';\n/** Used for variables that need to remain the same variable during render passes */\nexport function letState(defaultValue) {\n const config = setUse.memory.stateConfig;\n const rearray = config.rearray;\n let getSetMethod;\n const restate = rearray[config.array.length];\n if (restate) {\n let oldValue = getStateValue(restate);\n getSetMethod = ((x) => [oldValue, oldValue = x]);\n const push = {\n get: () => getStateValue(push),\n callback: getSetMethod,\n lastValue: oldValue,\n defaultValue: restate.defaultValue,\n };\n config.array.push(push);\n return makeStateResult(oldValue, push);\n }\n // State first time run\n const defaultFn = defaultValue instanceof Function ? defaultValue : () => defaultValue;\n let initValue = defaultFn();\n getSetMethod = ((x) => [initValue, initValue = x]);\n const push = {\n get: () => getStateValue(push),\n callback: getSetMethod,\n lastValue: initValue,\n defaultValue: initValue,\n };\n config.array.push(push);\n return makeStateResult(initValue, push);\n}\nfunction makeStateResult(initValue, push) {\n // return initValue\n const result = (y) => {\n push.callback = y || (x => [initValue, initValue = x]);\n return initValue;\n };\n return result;\n}\n","import { setUse } from \"./setUse.function\";\n/** When undefined, it means a tag is being built for the first time so do run destroy(s) */\nlet destroyCurrentTagSupport;\nexport function onDestroy(callback) {\n destroyCurrentTagSupport.templater.global.destroyCallback = callback;\n}\nsetUse({\n beforeRender: tagSupport => destroyCurrentTagSupport = tagSupport,\n beforeRedraw: tagSupport => destroyCurrentTagSupport = tagSupport,\n beforeDestroy: (tagSupport, tag) => {\n const callback = tagSupport.templater.global.destroyCallback;\n if (callback) {\n callback();\n }\n }\n});\n","import { setUse } from \"./setUse.function\";\nfunction setCurrentTagSupport(support) {\n setUse.memory.initCurrentTemplater = support.templater;\n}\nexport function onInit(callback) {\n const templater = setUse.memory.initCurrentTemplater;\n if (!templater.global.init) {\n ;\n templater.global.init = callback;\n callback(); // fire init\n }\n}\nsetUse({\n beforeRender: tagSupport => setCurrentTagSupport(tagSupport),\n beforeRedraw: tagSupport => setCurrentTagSupport(tagSupport),\n});\n","import { deepClone, deepEqual } from '../deepFunctions';\nimport { renderTagSupport } from '../renderTagSupport.function';\nexport function providersChangeCheck(tag) {\n const global = tag.tagSupport.templater.global;\n const providersWithChanges = global.providers.filter(provider => !deepEqual(provider.instance, provider.clone));\n // reset clones\n providersWithChanges.forEach(provider => {\n const appElement = tag.getAppElement();\n handleProviderChanges(appElement, provider);\n provider.clone = deepClone(provider.instance);\n });\n}\nfunction handleProviderChanges(appElement, provider) {\n const tagsWithProvider = getTagsWithProvider(appElement, provider);\n tagsWithProvider.forEach(({ tag, renderCount, provider }) => {\n if (tag.tagSupport.templater.global.deleted) {\n return; // i was deleted after another tag processed\n }\n const notRendered = renderCount === tag.tagSupport.templater.global.renderCount;\n if (notRendered) {\n provider.clone = deepClone(provider.instance);\n renderTagSupport(tag.tagSupport, false);\n }\n });\n}\nfunction getTagsWithProvider(tag, provider, memory = []) {\n const global = tag.tagSupport.templater.global;\n const compare = global.providers;\n const hasProvider = compare.find(xProvider => xProvider.constructMethod === provider.constructMethod);\n if (hasProvider) {\n memory.push({\n tag,\n renderCount: global.renderCount,\n provider: hasProvider,\n });\n }\n tag.childTags.forEach(child => getTagsWithProvider(child, provider, memory));\n memory.forEach(({ tag }) => {\n if (tag.tagSupport.templater.global.deleted) {\n throw new Error('do not get here - 0');\n }\n });\n return memory;\n}\n","import { deepClone } from '../deepFunctions';\nimport { setUse } from './setUse.function';\n// TODO: rename\nsetUse.memory.providerConfig = {\n providers: [],\n //currentTagSupport: undefined as TagSupport | undefined,\n ownerTag: undefined,\n};\nfunction get(constructMethod) {\n const config = setUse.memory.providerConfig;\n const providers = config.providers;\n return providers.find(provider => provider.constructMethod === constructMethod);\n}\nexport const providers = {\n create: (constructMethod) => {\n const existing = get(constructMethod);\n if (existing) {\n existing.clone = deepClone(existing.instance);\n return existing.instance;\n }\n // Providers with provider requirements just need to use providers.create() and providers.inject()\n const instance = constructMethod.constructor ? new constructMethod() : constructMethod();\n const config = setUse.memory.providerConfig;\n config.providers.push({\n constructMethod,\n instance,\n clone: deepClone(instance)\n });\n return instance;\n },\n /**\n * @template T\n * @param {(new (...args: any[]) => T) | () => T} constructor\n * @returns {T}\n */\n inject: (constructor) => {\n const oldValue = get(constructor);\n if (oldValue) {\n return oldValue.instance;\n }\n const config = setUse.memory.providerConfig;\n let owner = {\n ownerTag: config.ownerTag\n };\n while (owner.ownerTag) {\n const ownerProviders = owner.ownerTag.tagSupport.templater.global.providers;\n const provider = ownerProviders.find(provider => {\n if (provider.constructMethod === constructor) {\n return true;\n }\n });\n if (provider) {\n provider.clone = deepClone(provider.instance); // keep a copy of the latest before any change occur\n config.providers.push(provider);\n return provider.instance;\n }\n owner = owner.ownerTag; // cause reloop\n }\n const msg = `Could not inject provider: ${constructor.name} ${constructor}`;\n console.warn(`${msg}. Available providers`, config.providers);\n throw new Error(msg);\n }\n};\nsetUse({\n beforeRender: (tagSupport, ownerTag) => {\n run(tagSupport, ownerTag);\n },\n beforeRedraw: (tagSupport, tag) => {\n run(tagSupport, tag.ownerTag);\n },\n afterRender: (tagSupport) => {\n const config = setUse.memory.providerConfig;\n tagSupport.templater.global.providers = [...config.providers];\n config.providers.length = 0;\n }\n});\nfunction run(tagSupport, ownerTag) {\n const config = setUse.memory.providerConfig;\n // config.currentTagSupport = tagSupport\n config.ownerTag = ownerTag;\n if (tagSupport.templater.global.providers.length) {\n config.providers.length = 0;\n config.providers.push(...tagSupport.templater.global.providers);\n }\n}\n","import { getStateValue } from './state.utils';\nimport { setUse } from './setUse.function';\n/** Used for variables that need to remain the same variable during render passes */\nexport function setProp(getSet) {\n const config = setUse.memory.stateConfig;\n const rearray = config.rearray;\n const [propValue] = getSet(undefined);\n getSet(propValue); // restore original value instead of undefined\n const restate = rearray[config.array.length];\n if (restate) {\n let watchValue = restate.watch;\n let oldValue = getStateValue(restate);\n const push = {\n get: () => getStateValue(push),\n callback: getSet,\n lastValue: oldValue,\n watch: restate.watch,\n };\n // has the prop value changed?\n if (propValue != watchValue) {\n push.watch = propValue;\n oldValue = push.lastValue = propValue;\n }\n config.array.push(push);\n getSet(oldValue);\n return oldValue;\n }\n const push = {\n get: () => getStateValue(push),\n callback: getSet,\n lastValue: propValue,\n watch: propValue,\n };\n config.array.push(push);\n return propValue;\n}\n","const tagUse = [];\nexport function setUse(use) {\n // must provide defaults\n const useMe = {\n beforeRender: use.beforeRender || (() => undefined),\n beforeRedraw: use.beforeRedraw || (() => undefined),\n afterRender: use.afterRender || (() => undefined),\n beforeDestroy: use.beforeDestroy || (() => undefined),\n };\n setUse.tagUse.push(useMe);\n}\nsetUse.tagUse = tagUse;\nsetUse.memory = {};\n","import { setUse } from './setUse.function';\nimport { getStateValue } from './state.utils';\n/** Used for variables that need to remain the same variable during render passes */\nexport function state(defaultValue) {\n const config = setUse.memory.stateConfig;\n let getSetMethod;\n const rearray = config.rearray;\n const restate = rearray[config.array.length];\n if (restate) {\n let oldValue = getStateValue(restate);\n getSetMethod = ((x) => [oldValue, oldValue = x]);\n const push = {\n get: () => getStateValue(push),\n callback: getSetMethod,\n lastValue: oldValue,\n defaultValue: restate.defaultValue,\n };\n config.array.push(push);\n return oldValue;\n }\n // State first time run\n const defaultFn = defaultValue instanceof Function ? defaultValue : () => defaultValue;\n let initValue = defaultFn();\n getSetMethod = ((x) => [initValue, initValue = x]);\n const push = {\n get: () => getStateValue(push),\n callback: getSetMethod,\n lastValue: initValue,\n defaultValue: initValue,\n };\n config.array.push(push);\n return initValue;\n}\n","import { StateMismatchError } from '../errors';\nimport { setUse } from './setUse.function';\n// TODO: rename\nsetUse.memory.stateConfig = {\n array: [], // state memory on the first render\n // rearray: [] as StateConfigArray, // state memory to be used before the next render\n};\nsetUse({\n beforeRender: (tagSupport) => initState(tagSupport),\n beforeRedraw: (tagSupport) => initState(tagSupport),\n afterRender: (tagSupport) => {\n const state = tagSupport.memory.state;\n const config = setUse.memory.stateConfig;\n const rearray = config.rearray;\n if (rearray.length) {\n if (rearray.length !== config.array.length) {\n const message = `States lengths has changed ${rearray.length} !== ${config.array.length}. Typically occurs when a function is intended to be wrapped with a tag() call`;\n const details = {\n oldStates: config.array,\n newStates: config.rearray,\n component: tagSupport.templater?.wrapper.original,\n };\n const error = new StateMismatchError(message, details);\n console.warn(message, details);\n throw error;\n }\n }\n delete config.rearray; // clean up any previous runs\n state.newest = config.array; // [...config.array]\n state.newest.forEach(item => item.lastValue = getStateValue(item)); // set last values\n config.array = [];\n }\n});\nexport function getStateValue(\n// state: StateConfig,\nstate) {\n const callback = state.callback;\n if (!callback) {\n return state.defaultValue;\n }\n const oldState = callback(StateEchoBack); // get value and set to undefined\n const [oldValue] = oldState;\n const [checkValue] = callback(oldValue); // set back to original value\n if (checkValue !== StateEchoBack) {\n const message = 'State property not used correctly. Second item in array is not setting value as expected.\\n\\n' +\n 'For \"let\" state use `let name = state(default)(x => [name, name = x])`\\n\\n' +\n 'For \"const\" state use `const name = state(default)()`\\n\\n' +\n 'Problem state:\\n' + (callback ? callback.toString() : JSON.stringify(state)) + '\\n';\n console.error(message, { state, callback, oldState, oldValue, checkValue });\n throw new Error(message);\n }\n // state.lastValue = oldValue\n return oldValue;\n}\nexport class StateEchoBack {\n}\nfunction initState(tagSupport) {\n const state = tagSupport.memory.state;\n const config = setUse.memory.stateConfig;\n // TODO: This guard may no longer be needed\n if (config.rearray) {\n const message = 'last state not cleared. Possibly in the middle of rendering one component and another is trying to render';\n console.error(message, {\n config,\n component: tagSupport.templater?.wrapper.original,\n wasInMiddleOf: config.tagSupport?.templater.wrapper.original,\n state,\n expectedClearArray: config.rearray,\n });\n throw new StateMismatchError(message, {\n config,\n component: tagSupport.templater?.wrapper.original,\n state,\n expectedClearArray: config.rearray,\n });\n }\n // TODO: this maybe redundant and not needed\n config.rearray = []; // .length = 0\n if (state?.newest.length) {\n state.newest.map(state => getStateValue(state));\n config.rearray.push(...state.newest);\n }\n config.tagSupport = tagSupport;\n}\n","import { letState } from './letState.function';\n/** When an item in watch array changes, callback function will be triggered */\nexport function watch(currentValues, callback) {\n let previousValues = letState(undefined)(x => [previousValues, previousValues = x]);\n if (previousValues === undefined) {\n callback(currentValues, previousValues);\n // const result = {currentValues, previousValues}\n previousValues = currentValues;\n return currentValues;\n }\n const allExact = currentValues.every((item, index) => item === previousValues[index]);\n if (allExact) {\n return currentValues;\n }\n callback(currentValues, previousValues);\n previousValues.length = 0;\n previousValues.push(...currentValues);\n return currentValues;\n}\n","export class Subject {\n value;\n methods = [];\n isSubject = true;\n subscribers = [];\n subscribeWith;\n // unsubcount = 0 // 🔬 testing\n constructor(value) {\n this.value = value;\n }\n subscribe(callback) {\n // are we within a pipe?\n const subscribeWith = this.subscribeWith;\n if (subscribeWith) {\n // are we in a pipe?\n if (this.methods.length) {\n const orgCallback = callback;\n callback = (value) => {\n runPipedMethods(value, this.methods, lastValue => orgCallback(lastValue));\n };\n }\n return subscribeWith(callback);\n }\n this.subscribers.push(callback);\n SubjectClass.globalSubs.push(callback); // 🔬 testing\n const subscription = getSubscription(this, callback);\n return subscription;\n }\n set(value) {\n this.value = value;\n // Notify all subscribers with the new value\n this.subscribers.forEach((callback) => {\n callback.value = value;\n callback(value);\n });\n }\n next = this.set;\n toPromise() {\n return new Promise((res, rej) => {\n const subscription = this.subscribe(x => {\n subscription.unsubscribe();\n res(x);\n });\n });\n }\n pipe(...operations) {\n const subject = new Subject();\n subject.methods = operations;\n subject.subscribeWith = (x) => this.subscribe(x);\n return subject;\n }\n}\nfunction removeSubFromArray(subscribers, callback) {\n const index = subscribers.indexOf(callback);\n if (index !== -1) {\n subscribers.splice(index, 1);\n }\n}\nconst SubjectClass = Subject;\nSubjectClass.globalSubs = []; // 🔬 for testing\nSubjectClass.globalSubCount$ = new Subject(); // for ease of debugging\nSubjectClass.globalSubCount$.set(0);\nfunction getSubscription(subject, callback) {\n const countSubject = SubjectClass.globalSubCount$;\n SubjectClass.globalSubCount$.set(countSubject.value + 1);\n const subscription = () => {\n subscription.unsubscribe();\n };\n subscription.subscriptions = [];\n // Return a function to unsubscribe from the BehaviorSubject\n subscription.unsubscribe = () => {\n removeSubFromArray(subject.subscribers, callback); // each will be called when update comes in\n removeSubFromArray(SubjectClass.globalSubs, callback); // 🔬 testing\n SubjectClass.globalSubCount$.set(countSubject.value - 1);\n // any double unsubscribes will be ignored\n subscription.unsubscribe = () => subscription;\n // unsubscribe from any combined subjects\n subscription.subscriptions.forEach(subscription => subscription.unsubscribe());\n return subscription;\n };\n subscription.add = (sub) => {\n subscription.subscriptions.push(sub);\n return subscription;\n };\n return subscription;\n}\nfunction runPipedMethods(value, methods, onComplete) {\n const cloneMethods = [...methods];\n const firstMethod = cloneMethods.shift();\n const next = (newValue) => {\n if (cloneMethods.length) {\n return runPipedMethods(newValue, cloneMethods, onComplete);\n }\n onComplete(newValue);\n // return newValue = next\n };\n let handler = next;\n const setHandler = (x) => handler = x;\n const pipeUtils = { setHandler, next };\n const methodResponse = firstMethod(value, pipeUtils);\n handler(methodResponse);\n}\n","import { Subject } from './Subject.class';\nexport class ValueSubject extends Subject {\n value;\n constructor(value) {\n super(value);\n this.value = value;\n }\n subscribe(callback) {\n const subscription = super.subscribe(callback);\n // Call the callback immediately with the current value\n callback(this.value);\n return subscription;\n }\n}\n","import { Subject } from \"./Subject.class\";\nexport function combineLatest(subjects) {\n const output = new Subject();\n const subscribe = (callback) => {\n const valuesSeen = [];\n const values = [];\n const setValue = (x, index) => {\n valuesSeen[index] = true;\n values[index] = x;\n if (valuesSeen.length === subjects.length && valuesSeen.every(x => x)) {\n callback(values, subscription);\n }\n };\n const clones = [...subjects];\n const firstSub = clones.shift();\n const subscription = firstSub.subscribe(x => setValue(x, 0));\n const subscriptions = clones.map((subject, index) => subject.subscribe(x => setValue(x, index + 1)));\n subscription.subscriptions = subscriptions;\n return subscription;\n };\n output.subscribeWith = subscribe;\n return output;\n}\n","export * from './Subject.class';\nexport * from './ValueSubject';\nexport * from './combineLatest.function';\nexport * from './will.functions';\n","export function willCallback(callback) {\n return ((lastValue, utils) => {\n utils.setHandler(() => {\n return undefined;\n });\n callback(lastValue, utils.next);\n });\n}\n/** .pipe( promise((x) => Promise.resolve(44)) ) */\nexport function willPromise(callback) {\n return ((lastValue, utils) => {\n utils.setHandler(() => {\n return undefined;\n }); // do nothing on initial return\n const result = callback(lastValue);\n result.then(x => utils.next(x));\n });\n}\n/** .pipe( willSubscribe((x) => new ValueSubject(44)) ) */\nexport const willSubscribe = (callback) => {\n return ((lastValue, utils) => {\n utils.setHandler(() => {\n return undefined;\n }); // do nothing on initial return\n const result = callback(lastValue);\n const subscription = result.subscribe(x => {\n subscription.unsubscribe();\n utils.next(x);\n });\n });\n};\n","import { isSubjectInstance, isTagArray, isTagInstance } from './isInstance';\nimport { setUse } from './state';\nimport { TemplaterResult } from './TemplaterResult.class';\nimport { runTagCallback } from './bindSubjectCallback.function';\nimport { deepClone } from './deepFunctions';\nimport { TagSupport } from './TagSupport.class';\nimport { alterProps } from './alterProps.function';\nimport { ValueSubject } from './subject/ValueSubject';\nexport const tags = [];\nlet tagCount = 0;\n/** Wraps a tag component in a state manager and always push children to last argument as an array */\n// export function tag<T>(a: T): T;\nexport function tag(tagComponent) {\n const result = (function tagWrapper(props, children) {\n const isPropTag = isTagInstance(props) || isTagArray(props);\n if (isPropTag) {\n children = props;\n props = undefined;\n }\n const { childSubject, madeSubject } = kidsToTagArraySubject(children);\n childSubject.isChildSubject = true;\n const templater = new TemplaterResult(props, childSubject);\n const innerTagWrap = getTagWrap(templater, madeSubject);\n innerTagWrap.original = tagComponent;\n templater.tagged = true;\n templater.wrapper = innerTagWrap;\n return templater;\n }); // we override the function provided and pretend original is what's returned\n updateResult(result, tagComponent);\n // group tags together and have hmr pickup\n updateComponent(tagComponent);\n tags.push(tagComponent);\n return result;\n}\nfunction kidsToTagArraySubject(children) {\n if (isSubjectInstance(children)) {\n return { childSubject: children, madeSubject: false };\n }\n const kidArray = children;\n if (isTagArray(kidArray)) {\n return { childSubject: new ValueSubject(children), madeSubject: true };\n }\n const kid = children;\n if (kid) {\n kid.memory.arrayValue = 0;\n return { childSubject: new ValueSubject([kid]), madeSubject: true };\n }\n return {\n childSubject: new ValueSubject([]),\n madeSubject: true\n };\n}\nfunction updateResult(result, tagComponent) {\n result.isTag = true;\n result.original = tagComponent;\n}\nfunction updateComponent(tagComponent) {\n tagComponent.tags = tags;\n tagComponent.setUse = setUse;\n tagComponent.tagIndex = tagCount++; // needed for things like HMR\n}\n/** creates/returns a function that when called then calls the original component function */\nfunction getTagWrap(templater, madeSubject) {\n const innerTagWrap = function (oldTagSetup, subject) {\n const global = oldTagSetup.templater.global;\n global.newestTemplater = templater;\n ++global.renderCount;\n templater.global = global;\n const childSubject = templater.children;\n const lastArray = global.oldest?.tagSupport.templater.children.lastArray;\n if (lastArray) {\n childSubject.lastArray = lastArray;\n }\n const originalFunction = innerTagWrap.original;\n // const oldTagSetup = templater.tagSupport\n const oldest = templater.global.oldest;\n if (oldest && !oldest.hasLiveElements) {\n throw new Error('issue already 22');\n }\n let props = templater.props;\n const ownerTagSupport = oldTagSetup.ownerTagSupport;\n const oldTemplater = ownerTagSupport?.templater;\n const oldLatest = oldTemplater?.global.newest;\n const newestOwnerTemplater = oldLatest?.tagSupport.templater;\n if (oldLatest && !newestOwnerTemplater) {\n throw new Error('what to do here?');\n }\n let castedProps = alterProps(props, newestOwnerTemplater, oldTagSetup.ownerTagSupport);\n const clonedProps = deepClone(props); // castedProps\n // CALL ORIGINAL COMPONENT FUNCTION\n const tag = originalFunction(castedProps, childSubject);\n tag.version = global.renderCount;\n tag.tagSupport = new TagSupport(oldTagSetup.ownerTagSupport, templater, subject);\n tag.tagSupport.propsConfig = {\n latest: props, // castedProps\n latestCloned: clonedProps,\n clonedProps: clonedProps,\n lastClonedKidValues: tag.tagSupport.propsConfig.lastClonedKidValues,\n };\n tag.tagSupport.memory = oldTagSetup.memory; // state handover\n if (madeSubject) {\n childSubject.value.forEach(kid => {\n kid.values.forEach((value, index) => {\n if (!(value instanceof Function)) {\n return;\n }\n const valuesValue = kid.values[index];\n if (valuesValue.isChildOverride) {\n return; // already overwritten\n }\n // all functions need to report to me\n kid.values[index] = function (...args) {\n const ownerTag = tag.ownerTag;\n runTagCallback(value, // callback\n ownerTag, this, // bindTo\n args);\n };\n valuesValue.isChildOverride = true;\n });\n });\n }\n return tag;\n };\n return innerTagWrap;\n}\n","import { BaseTagSupport } from './TagSupport.class';\nimport { runAfterRender, runBeforeRender } from './tagRunner';\nimport { ValueSubject } from './subject/ValueSubject';\nconst appElements = [];\nexport function tagElement(app, // (...args: unknown[]) => TemplaterResult,\nelement, props) {\n const appElmIndex = appElements.findIndex(appElm => appElm.element === element);\n if (appElmIndex >= 0) {\n appElements[appElmIndex].tag.destroy();\n appElements.splice(appElmIndex, 1);\n // an element already had an app on it\n console.warn('Found and destroyed app element already rendered to element', { element });\n }\n // Create the app which returns [props, runOneTimeFunction]\n const wrapper = app(props);\n // have a function setup and call the tagWrapper with (props, {update, async, on})\n const result = applyTagUpdater(wrapper);\n const { tag } = result;\n // TODO: is the below needed?\n tag.appElement = element;\n tag.tagSupport.templater.global.isApp = true;\n const templateElm = document.createElement('template');\n templateElm.setAttribute('id', 'app-tag-' + appElements.length);\n templateElm.setAttribute('app-tag-detail', appElements.length.toString());\n element.appendChild(templateElm);\n tag.buildBeforeElement(templateElm);\n wrapper.global.oldest = tag;\n wrapper.global.newest = tag;\n if (!tag.hasLiveElements) {\n throw new Error('x');\n }\n ;\n element.setUse = app.original.setUse;\n appElements.push({ element, tag });\n return { tag, tags: app.original.tags };\n}\nexport function applyTagUpdater(wrapper) {\n const subject = new ValueSubject({});\n const tagSupport = new BaseTagSupport(wrapper, subject);\n wrapper.tagSupport = tagSupport;\n runBeforeRender(tagSupport, undefined);\n // Call the apps function for our tag templater\n const tag = wrapper.wrapper(tagSupport, subject);\n // wrapper.global.oldest = tag\n // wrapper.global.newest = tag\n runAfterRender(tagSupport, tag);\n return { tag, tagSupport };\n}\n","// TODO: This should be more like `new TaggedJs().use({})`\nimport { setUse } from './state';\n// Life cycle 1\nexport function runBeforeRender(tagSupport, tagOwner) {\n setUse.tagUse.forEach(tagUse => tagUse.beforeRender(tagSupport, tagOwner));\n}\n// Life cycle 2\nexport function runAfterRender(tagSupport, tag) {\n setUse.tagUse.forEach(tagUse => tagUse.afterRender(tagSupport, tag));\n}\n// Life cycle 3\nexport function runBeforeRedraw(tagSupport, tag) {\n setUse.tagUse.forEach(tagUse => tagUse.beforeRedraw(tagSupport, tag));\n}\n// Life cycle 4 - end of life\nexport function runBeforeDestroy(tagSupport, tag) {\n setUse.tagUse.forEach(tagUse => tagUse.beforeDestroy(tagSupport, tag));\n}\n","// Function to update the value of x\nexport function updateBeforeTemplate(value, lastFirstChild) {\n const parent = lastFirstChild.parentNode;\n let castedValue = value;\n // mimic React skipping to display EXCEPT for true does display on page\n if ([undefined, false, null].includes(value)) { // || value === true\n castedValue = '';\n }\n // Insert the new value (never use innerHTML here)\n const textNode = document.createTextNode(castedValue); // never innerHTML\n parent.insertBefore(textNode, lastFirstChild);\n /* remove existing nodes */\n parent.removeChild(lastFirstChild);\n return textNode;\n}\n","import { hasTagSupportChanged } from './hasTagSupportChanged.function';\nimport { processSubjectComponent } from './processSubjectComponent.function';\nimport { destroyTagMemory } from './destroyTag.function';\nimport { renderTagSupport } from './renderTagSupport.function';\nimport { callbackPropOwner } from './alterProps.function';\nexport function updateExistingTagComponent(ownerTag, templater, subject, insertBefore) {\n let existingTag = subject.tag;\n const oldWrapper = existingTag.tagSupport.templater.wrapper;\n const newWrapper = templater.wrapper;\n let isSameTag = false;\n if (oldWrapper && newWrapper) {\n const oldFunction = oldWrapper.original;\n const newFunction = newWrapper.original;\n isSameTag = oldFunction === newFunction;\n }\n const oldTagSupport = existingTag.tagSupport;\n const oldGlobal = oldTagSupport.templater.global;\n // const placeholderElm = ownerTag.tagSupport.templater.global.placeholderElm\n const placeholderElm = oldGlobal.placeholder;\n if (placeholderElm) {\n if (!placeholderElm.parentNode) {\n throw new Error('stop here no subject parent node update existing tag');\n }\n }\n if (!isSameTag) {\n destroyTagMemory(oldTagSupport.templater.global.oldest, subject);\n return processSubjectComponent(templater, subject, \n // ??? - newly changed\n insertBefore, // oldInsertBefore,\n ownerTag, {\n forceElement: false,\n counts: { added: 0, removed: 0 },\n });\n }\n else {\n const newTagSupport = templater.tagSupport;\n const hasChanged = hasTagSupportChanged(oldTagSupport, newTagSupport, templater);\n if (!hasChanged) {\n // if the new props are an object then implicitly since no change, the old props are an object\n const newProps = templater.props;\n if (newProps && typeof (newProps) === 'object') {\n // const newestTag = oldTagSupport.templater.global.newest\n // const oldProps = existingTag.tagSupport.propsConfig.latestCloned as Record<string,any> // newestTag.props as Record<string, any>\n syncFunctionProps(templater, existingTag, ownerTag, newProps);\n }\n return existingTag; // its the same tag component\n }\n }\n const oldestTag = templater.global.oldest; // oldTagSupport.oldest as Tag // existingTag\n const previous = templater.global.newest;\n if (!previous || !oldestTag) {\n throw new Error('how no previous or oldest nor newest?');\n }\n const newTag = renderTagSupport(templater.tagSupport, false);\n existingTag = subject.tag;\n const newOldest = newTag.tagSupport.templater.global.oldest;\n const hasOldest = newOldest ? true : false;\n if (!hasOldest) {\n return buildNewTag(newTag, \n // ??? newly changed\n insertBefore, // oldInsertBefore,\n oldTagSupport, subject);\n }\n if (newOldest && templater.children.value.length) {\n const oldKidsSub = newOldest.tagSupport.templater.children;\n oldKidsSub.set(templater.children.value);\n }\n // const newTag = tempResult.newest as Tag\n if (previous && !oldestTag) {\n throw new Error('bad elders');\n }\n // detect if both the function is the same and the return is the same\n const isLikeTag = isSameTag && previous.isLikeTag(newTag);\n if (previous && !oldestTag) {\n throw new Error('bad elders');\n }\n let oldest = oldTagSupport.templater.global.oldest;\n if (isLikeTag) {\n if (!newTag.tagSupport.templater.global.oldest) {\n throw new Error('maybe 6');\n }\n subject.tag = newTag;\n oldestTag.updateByTag(newTag); // the oldest tag has element references\n return newTag;\n }\n else {\n // Although function looked the same it returned a different html result\n if (isSameTag && existingTag) {\n destroyTagMemory(existingTag, subject);\n newTag.tagSupport.templater.global.context = {}; // do not share previous outputs\n }\n oldest = undefined;\n }\n if (!oldest) {\n buildNewTag(newTag, oldTagSupport.templater.global.insertBefore, oldTagSupport, subject);\n }\n oldTagSupport.templater.global.newest = newTag;\n return newTag;\n}\nfunction checkStateChanged(state) {\n return !state.newest.every(state => {\n const lastValue = state.lastValue;\n const nowValue = state.get();\n const matched = lastValue === nowValue;\n if (matched) {\n return true;\n }\n return false;\n });\n}\nfunction buildNewTag(newTag, oldInsertBefore, oldTagSupport, subject) {\n newTag.buildBeforeElement(oldInsertBefore, {\n forceElement: true,\n counts: { added: 0, removed: 0 },\n });\n newTag.tagSupport.templater.global.oldest = newTag;\n newTag.tagSupport.templater.global.newest = newTag;\n oldTagSupport.templater.global.oldest = newTag;\n oldTagSupport.templater.global.newest = newTag;\n subject.tag = newTag;\n return newTag;\n}\nfunction syncFunctionProps(templater, existingTag, ownerTag, newProps) {\n existingTag = existingTag.tagSupport.templater.global.newest;\n // const templater = existingTag.tagSupport.templater\n const priorProps = existingTag.tagSupport.propsConfig.latestCloned;\n const oldLatest = ownerTag.tagSupport.templater.global.newest;\n const ownerSupport = oldLatest.tagSupport;\n Object.entries(priorProps).forEach(([name, value]) => {\n if (!(value instanceof Function)) {\n return;\n }\n const newOriginal = value.original;\n // TODO: The code below maybe irrelevant\n const newCallback = newProps[name];\n const original = newCallback.original;\n if (original) {\n return; // already previously converted\n }\n // Currently, call self but over parent state changes, I may need to call a newer parent tag owner\n priorProps[name].toCall = (...args) => {\n return callbackPropOwner(newCallback, // value, // newOriginal,\n args, templater, ownerSupport);\n };\n return;\n });\n}\n","import { TagSupport } from './TagSupport.class';\nimport { isSubjectInstance, isTagArray, isTagComponent, isTagInstance } from './isInstance';\nimport { processTagArray } from './processTagArray';\nimport { updateExistingTagComponent } from './updateExistingTagComponent.function';\nimport { processRegularValue } from './processRegularValue.function';\nimport { checkDestroyPrevious } from './checkDestroyPrevious.function';\nimport { processSubjectComponent } from './processSubjectComponent.function';\nimport { isLikeTags } from './isLikeTags.function';\nimport { bindSubjectCallback } from './bindSubjectCallback.function';\nimport { applyFakeTemplater, processTag } from './processTag.function';\nexport function updateExistingValue(subject, value, ownerTag, insertBefore) {\n const subjectTag = subject;\n const isComponent = isTagComponent(value);\n checkDestroyPrevious(subject, value, insertBefore);\n // handle already seen tag components\n if (isComponent) {\n const templater = value;\n // When was something before component\n if (!subjectTag.tag) {\n processSubjectComponent(templater, subjectTag, insertBefore, // oldInsertBefore as InsertBefore,\n ownerTag, {\n forceElement: true,\n counts: { added: 0, removed: 0 },\n });\n return subjectTag;\n }\n templater.tagSupport = new TagSupport(\n // subjectTag.tag.tagSupport.ownerTagSupport,\n ownerTag.tagSupport, templater, subjectTag);\n updateExistingTagComponent(ownerTag, templater, // latest value\n subjectTag, insertBefore);\n return subjectTag;\n }\n // was component but no longer\n const tag = subjectTag.tag;\n if (tag) {\n handleStillTag(tag, subject, value, ownerTag);\n return subjectTag;\n }\n // its another tag array\n if (isTagArray(value)) {\n processTagArray(subject, value, insertBefore, // oldInsertBefore as InsertBefore,\n ownerTag, { counts: {\n added: 0,\n removed: 0,\n } });\n return subject;\n }\n // now its a function\n if (value instanceof Function) {\n // const newSubject = getSubjectFunction(value, ownerTag)\n const bound = bindSubjectCallback(value, ownerTag);\n subject.set(bound);\n return subject;\n }\n if (isTagInstance(value)) {\n if (insertBefore.nodeName !== 'TEMPLATE') {\n throw new Error(`expected template - ${insertBefore.nodeName}`);\n }\n processTag(value, subjectTag, insertBefore, ownerTag);\n return subjectTag;\n }\n // we have been given a subject\n if (isSubjectInstance(value)) {\n return value;\n }\n // This will cause all other values to render\n processRegularValue(value, subject, \n // ??? - changed to insertBefore for tag switching with template removal\n insertBefore // oldInsertBefore as InsertBefore,\n );\n return subjectTag;\n}\nfunction handleStillTag(existingTag, subject, value, ownerTag) {\n // TODO: We shouldn't need both of these\n const isSameTag = value && isLikeTags(existingTag, value);\n const isSameTag2 = value && value.getTemplate && existingTag.isLikeTag(value);\n const tag = value;\n if (!tag.tagSupport) {\n applyFakeTemplater(tag, ownerTag, subject);\n }\n if (isSameTag) {\n existingTag.updateByTag(tag);\n return;\n }\n if (isSameTag || isSameTag2) {\n const subjectTag = subject;\n const global = existingTag.tagSupport.templater.global;\n const insertBefore = global.insertBefore;\n return processTag(value, subjectTag, insertBefore, ownerTag);\n }\n return processRegularValue(value, subject, subject.insertBefore);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// import { redrawTag } from \"./redrawTag.function\"\nimport { tagElement } from \"./tagElement\";\nexport * from \"./ElementTargetEvent.interface\";\nexport * from \"./tag\";\nexport * from \"./html\";\nexport * from \"./errors\";\nexport * from \"./subject/index\";\nexport * from \"./isInstance\";\nexport * from \"./state/index\";\nexport * from \"./TagSupport.class\";\n// export * from \"./redrawTag.function\"\nexport * from \"./interpolateElement\";\n// TODO: export *\nexport { tagElement } from \"./tagElement\";\nexport { Tag } from \"./Tag.class\";\nexport { runBeforeRender } from \"./tagRunner\";\nexport const hmr = {\n tagElement,\n // redrawTag\n};\n"],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"bundle.js","mappings":";;;;;;;;;AAAU;;;;;;;;;;;;;;;;;;ACAH;AACA;AACA;AACA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnB6D;AACjB;AAC8B;AACb;AACM;AACpB;AACW;AACW;AACJ;AACJ;AACI;AAC2B;AACjB;AACE;AAC7E,gCAAgC,sDAAc;AAC9C;AACO;AACP;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,sBAAsB,+EAA+E;AACrG;AACA;AACA;AACA;AACA,mBAAmB,+EAA+E;AAClG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA,uCAAuC;AACvC,6BAA6B,yDAAS;AACtC;AACA;AACA;AACA;AACA,oCAAoC,0EAAe;AACnD;AACA,aAAa;AACb;AACA;AACA,aAAa,2DAAc,YAAY,uDAAU;AACjD,4CAA4C,yDAAS;AACrD;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,iBAAiB;AACjB;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gFAAgB;AACpC;AACA;AACA;AACA;AACA;AACA,4BAA4B,2DAAc;AAC1C;AACA,YAAY,4DAAgB;AAC5B;AACA,kDAAkD,uEAAqB;AACvE;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,mBAAmB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE,4BAA4B;AAChG;AACA,aAAa;AACb;AACA;AACA,yEAAyE,4BAA4B;AACrG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,UAAU;AAC9B;AACA,KAAK;AACL;AACA,0GAA0G;AAC1G,gCAAgC;AAChC;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,kFAAmB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,sDAAc;AAC/C;AACA;AACA;AACA;AACA;AACA,uBAAuB,8EAAiB;AACxC;AACA;AACA;AACA;AACA;AACA,oCAAoC,0EAAe;AACnD,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,kBAAkB,sBAAsB;AACxC,KAAK;AACL;AACA;AACA;AACA;AACA,YAAY,+EAAiB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8EAA8E,gBAAgB;AAC9F;AACA,gBAAgB,gBAAgB,EAAE,uFAAkB;AACpD;AACA;AACA;AACA,SAAS;AACT,QAAQ,2FAAuB;AAC/B;AACA;AACA;AACA;AACA,YAAY,yFAAmB,+FAA+F,gBAAgB;AAC9I,YAAY,2FAAuB;AACnC;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,sDAAc;AAC1E,sEAAsE,EAAE,sDAAc,CAAC,EAAE,OAAO;AAChG;AACA;AACA;AACA,SAAS;AACT,8BAA8B,sFAAiB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,sBAAsB;AAC5C,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;AC5S+E;AAC9C;AACkB;AACM;AAClD;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,2DAAe;AACvB;AACA;AACA;AACA,QAAQ,2DAAe;AACvB;AACA,0BAA0B,0CAAM;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,0DAAc;AAClB,sCAAsC,gEAAU;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sEAAgB;AACpB;AACA,yBAAyB,gBAAgB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACnEuC;AAC8B;AAC9D;AACP;AACA;AACA,mBAAmB,oDAAW;AAC9B;AACA;AACA;AACA,4BAA4B,kFAAa;AACzC;AACA;AACA;;;;;;;;;;;;;;;;;;ACZqC;AAC0B;AAC/D;AACO;AACP;AACA;AACA;AACA,sBAAsB,kDAAK;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACO;AACP;AACA;AACA,IAAI,4EAAgB;AACpB;AACA;;;;;;;;;;;;;;;;;;;;;ACzCiE;AACd;AAC6B;AAC3B;AAC9C;AACP;AACA;AACA;AACA;AACA,qBAAqB,uDAAU;AAC/B;AACA;AACA;AACA,QAAQ,kEAAW;AACnB,4BAA4B,YAAY,mCAAmC,sBAAsB;AACjG;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,kDAAK;AAChC,6BAA6B,kDAAK;AAClC;AACA;AACA;AACA,iBAAiB,gEAAU;AAC3B;AACA;AACA,gBAAgB,sEAAgB;AAChC;AACA;AACA;AACA;AACA,oCAAoC,2DAAc;AAClD;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA,QAAQ,sEAAgB;AACxB;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP,IAAI,2EAAqB;AACzB;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,QAAQ,kEAAW;AACnB;AACA;;;;;;;;;;;;;;;;;AC/E4C;AAC0C;AAC/E;AACP;AACA;AACA,YAAY,2DAAc;AAC1B;AACA,mBAAmB,yDAAS;AAC5B;AACA,YAAY,uDAAU,SAAS,2DAAc;AAC7C;AACA;AACA,YAAY,uDAAU;AACtB;AACA;AACA,eAAe,yDAAS;AACxB,KAAK;AACL;;;;;;;;;;;;;;;;ACjBO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,gBAAgB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACpGO;AACP,2CAA2C,YAAY;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACRO;AACP;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;;;;;;;;;;;;;;;ACZO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;;;;;;;;;;;;;;;;;;ACfO;AACP;AACA,gDAAgD;AAChD;AACA;AACA,yBAAyB;AACzB;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACzB4C;AACrC;AACP,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB,4BAA4B,wBAAwB;AACpD;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA,qCAAqC;AACrC,yCAAyC;AACzC;AACA,SAAS;AACT;AACA,sBAAsB;AACtB;AACA;AACA,oBAAoB,yDAAS;AAC7B,gCAAgC;AAChC;AACO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;;;;;;;;;;ACpEkC;AAC3B;AACP,eAAe,2CAAG;AAClB;;;;;;;;;;;;;;;ACHA;AACO;AACP;AACA;AACA;;;;;;;;;;;;;;;;;ACJA;AACgE;AACzD;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C,aAAa;AACb;AACA,+BAA+B;AAC/B;AACA,IAAI,4EAAgB;AACpB;AACA;AACA;AACA,+CAA+C;AAC/C;AACA,YAAY,4EAAgB;AAC5B;AACA,SAAS;AACT;AACA;AACA;AACA;;;;;;;;;;;;;;;ACtCO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;;;;;;;;;;;;;;;AChBO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACjB+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,4EAAgB;AACxB,sCAAsC;AACtC,KAAK;AACL;;;;;;;;;;;;;;;;AClB4D;AACrD;AACP;AACA,iBAAiB,iCAAiC;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,mCAAmC,EAAE,yEAAmB;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,eAAe,EAAE,yEAAmB;AAChE;AACA;AACA;AACA;AACA,wBAAwB,sDAAsD;AAC9E;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACxCgE;AACN;AACkB;AAChB;AAC5D;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,uDAAuD,EAAE,yFAA2B;AACpG;AACA;AACA;AACA,IAAI,6EAAqB;AACzB;AACA,aAAa;AACb;AACA;AACA;AACA,QAAQ,6EAAqB;AAC7B;AACA;AACA;AACA,KAAK;AACL;AACO;AACP,mBAAmB,uEAAsB;AACzC,0CAA0C,oDAAY,EAAE,sDAAc;AACtE;AACA;;;;;;;;;;;;;;;;;;;;;;;AClC8C;AACQ;AACgB;AACX;AACM;AACK;AAC/D;AACP,+BAA+B,WAAW,MAAM;AAChD;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,UAAU;AAC3B;AACA;AACA,mCAAmC,sDAAc,aAAa,sDAAc;AAC5E,iBAAiB,UAAU;AAC3B;AACA;AACA,sBAAsB,2DAAc,2BAA2B,uDAAU;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+EAA+E,gBAAgB;AAC/F,aAAa;AACb;AACO;AACP,EAAE,gBAAgB;AAClB;AACA;AACA;AACA,YAAY,kFAAmB;AAC/B;AACA;AACA;AACA,QAAQ,kFAAmB;AAC3B,sBAAsB,WAAW;AACjC;AACA,SAAS;AACT;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,kCAAkC;AAClC;AACA,QAAQ,8EAAiB;AACzB;AACA;AACA,WAAW,mEAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;;;;;;;;;;;;;;;AC9EA;AACO,sGAAsG,WAAW,GAAG;AAC3H,eAAe,GAAG;AACX;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,GAAG;AACnD,KAAK;AACL,aAAa;AACb;;;;;;;;;;;;;;;;;;AChBkD;AACA;AACmB;AACrE,wBAAwB;AACxB,kBAAkB;AAClB;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,+DAAc;AAC7B;AACA;AACA,yDAAyD;AACzD;AACA,8DAA8D,UAAU;AACxE;AACA;AACA;AACA;AACA,iCAAiC,8CAA8C;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,8DAAiB;AACzB;AACA;AACA;AACA,+BAA+B,kFAAmB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,+DAAc;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACxH+D;AAC/D,0EAA0E,IAAI;AACvE;AACP;AACA;AACA,+CAA+C,IAAI;AACnD;AACA,0BAA0B,cAAc;AACxC;AACA;AACA;AACA,QAAQ,4EAAgB;AACxB;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACdO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP,+EAA+E;AAC/E;AACO;AACP;AACA;;;;;;;;;;;;;;;ACnBO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,KAAK;AACL;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACrCsD;AACuC;AACnC;AACV;AACzC;AACP,QAAQ,2DAAc;AACtB,+BAA+B,+DAAY;AAC3C;AACA;AACA;AACA,mBAAmB,+DAAY;AAC/B;AACA;AACA,mBAAmB,+DAAY;AAC/B;AACA,QAAQ,2DAAc;AACtB;AACA;AACA;AACA;AACA,QAAQ,uDAAU;AAClB;AACA;AACA;AACA,QAAQ,8DAAiB;AACzB;AACA;AACA,eAAe,+DAAY;AAC3B;AACA;AACA;AACA;AACA;AACA,6BAA6B,+DAAY;AACzC,wBAAwB,mEAAe;AACvC;AACA;AACA;AACA,wBAAwB,+DAAY;AACpC,gDAAgD,yDAAU;AAC1D;AACA;;;;;;;;;;;;;;;;ACzCuE;AAChE;AACP;AACA;AACA,kDAAkD;AAClD;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,kBAAkB,oFAAoB;AACtC,2BAA2B;AAC3B;;;;;;;;;;;;;;;;;;;ACb4D;AAC3B;AAC8B;AACf;AACzC;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uIAAuI,MAAM;AAC7I;AACA;AACA,2BAA2B,yDAAU;AACrC;AACA;AACA;AACA,sBAAsB,0CAAM;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,4EAAgB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,yEAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;AC/C6E;AACS;AAClC;AACiB;AACA;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,gCAAgC;AACjC;AACA,QAAQ,2DAAc;AACtB;AACA;AACA,QAAQ,2DAAc;AACtB;AACA;AACA,QAAQ,uDAAU;AAClB;AACA;AACA,QAAQ,uDAAU;AAClB;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,gEAAU;AACtB;AACA;AACA;AACA;AACA;AACA,4BAA4B,sEAAgB;AAC5C;AACA,YAAY,gEAAU;AACtB;AACA;AACA,mBAAmB,iEAAe;AAClC;AACA,YAAY,0FAAuB;AACnC;AACA;AACA,IAAI,kFAAmB;AACvB;;;;;;;;;;;;;;;;;;;;ACrDgD;AACP;AACzC;AACO;AACP;AACA;AACA;AACA;AACA,yBAAyB,yDAAU;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,sBAAsB;AACxC;AACA,KAAK;AACL;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA,sBAAsB,kDAAY;AAClC,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;ACzCsD;AACX;AACuB;AACU;AAC5B;AACN;AACnC;AACP;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,+EAAe;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,YAAY,uDAAU;AACtB,YAAY,sEAAgB;AAC5B;AACA,+BAA+B,yDAAU,qCAAqC,+DAAY;AAC1F;AACA;AACA,YAAY,uEAAiB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,oDAAe;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,4CAA4C;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACtHO;AACP;AACA,EAAE,uBAAuB;AACzB;AACA;AACA;AACA,iEAAiE;AACjE,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AC5BO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACf8D;AACF;AACT;AACnD;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,2EAAoB;AACxB;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA,sBAAsB,yEAAiB;AACvC;AACA;AACA;AACA;AACA,QAAQ,gEAAU;AAClB;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACjC4C;AACqB;AACjE;AACO;AACP;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,yDAAS;AACvC;AACA;AACA;AACA;AACA,gBAAgB,8EAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACrCO;AACP;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACN2C;AACG;AACkB;AAClB;AAC9C;AACA,cAAc,sDAAiB;AAC/B;AACO;AACP,sCAAsC;AACtC,wDAAM;AACN;AACA;AACA;AACA,wCAAwC;AACxC,KAAK;AACL,CAAC;AACD;AACA;AACA,0BAA0B,2DAAa;AACvC;AACA;AACA,iCAAiC;AACjC;AACA,8CAA8C;AAC9C,KAAK;AACL;AACA;AACA,qBAAqB,oDAAM;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,4EAAgB;AACpB;AACA;AACA;AACA;AACA,YAAY,4EAAgB;AAC5B,SAAS;AACT;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjDiC;AACU;AACF;AACM;AACF;AACL;AACC;AAChB;AACG;;;;;;;;;;;;;;;;;ACRkB;AACH;AAC3C;AACO;AACP,mBAAmB,oDAAM;AACzB;AACA;AACA;AACA;AACA,uBAAuB,2DAAa;AACpC;AACA;AACA,uBAAuB,2DAAa;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2DAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACxC2C;AAC3C;AACA;AACO;AACP;AACA;AACA,wDAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;;;;;;;;;;;;;;ACf0C;AAC3C;AACA,IAAI,oDAAM;AACV;AACO;AACP,uBAAuB,oDAAM;AAC7B;AACA;AACA,oBAAoB;AACpB;AACA;AACA,wDAAM;AACN;AACA;AACA,CAAC;;;;;;;;;;;;;;;;;ACduD;AACQ;AACzD;AACP;AACA,sEAAsE,yDAAS;AAC/E;AACA;AACA;AACA;AACA,yBAAyB,yDAAS;AAClC,KAAK;AACL;AACA;AACA;AACA,gCAAgC,mCAAmC;AACnE;AACA,oBAAoB;AACpB;AACA;AACA;AACA,6BAA6B,yDAAS;AACtC,YAAY,4EAAgB;AAC5B;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACtC6C;AACF;AAC3C,oDAAM;AACN;AACA;AACA;AACA;AACA,mBAAmB,oDAAM;AACzB;AACA;AACA;AACO;AACP;AACA;AACA;AACA,6BAA6B,yDAAS;AACtC;AACA;AACA;AACA;AACA,uBAAuB,oDAAM;AAC7B;AACA;AACA;AACA,mBAAmB,yDAAS;AAC5B,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA,eAAe,uCAAuC;AACtD,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,oDAAM;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,iCAAiC,yDAAS,qBAAqB;AAC/D;AACA;AACA;AACA,2CAA2C;AAC3C;AACA,kDAAkD,kBAAkB,EAAE,YAAY;AAClF,wBAAwB,IAAI;AAC5B;AACA;AACA;AACA,wDAAM;AACN;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA,uBAAuB,oDAAM;AAC7B;AACA;AACA;AACA,CAAC;AACD;AACA,mBAAmB,oDAAM;AACzB;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACjF8C;AACH;AAC3C;AACO;AACP,mBAAmB,oDAAM;AACzB;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA,uBAAuB,2DAAa;AACpC;AACA,uBAAuB,2DAAa;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2DAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACnCA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACZ2C;AACG;AAC9C;AACO;AACP,mBAAmB,oDAAM;AACzB;AACA;AACA;AACA;AACA,uBAAuB,2DAAa;AACpC;AACA;AACA,uBAAuB,2DAAa;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2DAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;AChC+C;AACJ;AAC3C;AACA,oDAAM;AACN;AACA;AACA;AACA;AACA,wDAAM;AACN;AACA;AACA;AACA;AACA;AACA,uBAAuB,oDAAM;AAC7B;AACA;AACA;AACA,8DAA8D,gBAAgB,MAAM,oBAAoB;AACxG;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,uDAAkB;AACpD;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,qCAAqC;AACrC,4EAA4E;AAC5E;AACA;AACA,CAAC;AACM;AACP;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA,iCAAiC,iDAAiD;AAClF;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,mBAAmB,oDAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,kBAAkB,uDAAkB;AACpC;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACzF+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACO;AACP,yBAAyB,4DAAQ;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACvBO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;;;;;;;;;;;;;;;;ACrH0C;AACnC,2BAA2B,mDAAO;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACb0C;AACnC;AACP,uBAAuB,mDAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;ACtBgC;AACD;AACU;AACR;;;;;;;;;;;;;;;;;ACH1B;AACP;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACO;AACP;AACA;AACA;AACA,SAAS,GAAG;AACZ;AACA;AACA,KAAK;AACL;AACA;AACO;AACP;AACA;AACA;AACA,SAAS,GAAG;AACZ;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;;;;;;;;;;;;;;;;;;;;;;;AC9ByF;AACxD;AACyB;AACqB;AACnC;AACI;AACG;AACG;AAC/C;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA,0BAA0B,uDAAU,WAAW,2DAAc,WAAW,uDAAU;AAClF;AACA;AACA;AACA;AACA,gBAAgB,4BAA4B;AAC5C;AACA,8BAA8B,mEAAe;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,GAAG;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,8DAAiB;AACzB,iBAAiB;AACjB;AACA;AACA,QAAQ,uDAAU;AAClB,iBAAiB,kBAAkB,+DAAY;AAC/C;AACA;AACA;AACA;AACA,iBAAiB,kBAAkB,+DAAY;AAC/C;AACA;AACA,0BAA0B,+DAAY;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,0CAAM;AAChC,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,gEAAU;AACpC,4BAA4B,yDAAS,SAAS;AAC9C;AACA;AACA;AACA;AACA,+BAA+B,yDAAU;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA,wBAAwB,4FAAc;AACtC;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACtHoD;AACU;AACR;AACtD;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,sFAAsF,SAAS;AAC/F;AACA;AACA;AACA,mEAAmE,kBAAkB;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACO;AACP;AACA,wBAAwB,+DAAY;AACpC,qBAAqB,6DAAc;AACnC;AACA;AACA,IAAI,2DAAe;AACnB;AACA;AACA;AACA,IAAI,0DAAc;AAClB;AACA;;;;;;;;;;;;;;;;;;;;;AC/CA,wDAAwD;AACvB;AACG;AACpC;AACO,uBAAuB,6CAAO;AACrC,SAAS,0CAAM;AACf,6BAA6B;AAC7B;AACA,CAAC;AACD;AACO;AACP,IAAI,0CAAM;AACV;AACA;AACO;AACP,IAAI,0CAAM;AACV;AACA;AACA;AACO;AACP,IAAI,0CAAM;AACV;AACA;AACO;AACP,IAAI,0CAAM;AACV;;;;;;;;;;;;;;;ACzBA;AACO;AACP;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACdiE;AACjB;AACzC;AACP;AACA;AACA;AACA;AACA;AACA,gBAAgB,2DAAc;AAC9B;AACA,qCAAqC,yDAAU;AAC/C,oBAAoB,2DAAc;AAClC;AACA;AACA;AACA;AACA;AACA,QAAQ,8DAAiB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;ACzCuE;AACM;AACpB;AACM;AACL;AACP;AAC5C;AACP;AACA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,sEAAgB;AACxB,eAAe,0FAAuB;AACtC;AACA,sBAAsB,sBAAsB;AAC5C,SAAS;AACT;AACA;AACA,2BAA2B,oFAAoB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA,uBAAuB,4EAAgB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gEAAU;AAC7C;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA,YAAY,sEAAgB;AAC5B,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,sBAAsB;AACxC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,mBAAmB,uEAAiB;AACpC;AACA;AACA;AACA,KAAK;AACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC5GgD;AACU;AAC+C;AACrD;AAC+B;AACd;AACE;AACjB;AACuB;AAC1B;AACiC;AACI;AACnC;AAC9C;AACP;AACA,wBAAwB,2DAAc;AACtC,IAAI,oFAAoB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,uDAAU;AAClB,QAAQ,iEAAe;AACvB,wBAAwB;AACxB;AACA;AACA,eAAe;AACf;AACA;AACA,QAAQ,2DAAc;AACtB,QAAQ,iEAAU;AAClB;AACA;AACA,QAAQ,uDAAU;AAClB;AACA;AACA;AACA,wBAAwB,uEAAgB;AACxC;AACA;AACA;AACA,QAAQ,iEAAU;AAClB;AACA;AACA;AACA,QAAQ,8DAAiB;AACzB;AACA;AACA;AACA;AACA,sBAAsB,kGAAmB;AACzC;AACA;AACA;AACA;AACA,IAAI,kFAAmB;AACvB;AACA;AACA;AACA;AACA;AACA,oBAAoB,uDAAU;AAC9B;AACA;AACA;AACA;AACA,iCAAiC,+DAAY;AAC7C,4BAA4B,mEAAe;AAC3C;AACA;AACA;AACA;AACA,6BAA6B,yDAAU;AACvC;AACA;AACA;AACA,+BAA+B,gEAAU;AACzC,QAAQ,2DAAc;AACtB,QAAQ,wEAAiB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,iEAAU;AACzB;AACA,WAAW,kFAAmB;AAC9B;AACA;AACA;AACA;AACA,QAAQ,0FAAuB;AAC/B;AACA;AACA,sBAAsB,sBAAsB;AAC5C,SAAS;AACT;AACA;AACA,2BAA2B,yDAAU;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,mEAAW;AACvB;AACA;AACA;AACA,QAAQ,0FAAuB;AAC/B;AACA,sBAAsB,sBAAsB;AAC5C,SAAS;AACT;AACA;AACA;AACA;AACA,IAAI,gGAA0B;AAC9B;AACA;AACA;;;;;;;SCxIA;SACA;;SAEA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;;SAEA;SACA;;SAEA;SACA;SACA;;;;;UCtBA;UACA;UACA;UACA;UACA,yCAAyC,wCAAwC;UACjF;UACA;UACA;;;;;UCPA;;;;;UCAA;UACA;UACA;UACA,uDAAuD,iBAAiB;UACxE;UACA,gDAAgD,aAAa;UAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNA,YAAY,YAAY;AACkB;AACK;AACzB;AACC;AACE;AACO;AACH;AACC;AACK;AACnC;AACoD;AACpD;AAC0C;AACR;AACY;AACiB;AACxD;AACP,cAAc;AACd;AACA","sources":["webpack://taggedjs/./ts/ElementTargetEvent.interface.ts","webpack://taggedjs/./ts/Tag.class.ts","webpack://taggedjs/./ts/TagSupport.class.ts","webpack://taggedjs/./ts/TemplaterResult.class.ts","webpack://taggedjs/./ts/afterInterpolateElement.function.ts","webpack://taggedjs/./ts/alterProps.function.ts","webpack://taggedjs/./ts/checkDestroyPrevious.function.ts","webpack://taggedjs/./ts/cloneValueArray.function.ts","webpack://taggedjs/./ts/deepFunctions.ts","webpack://taggedjs/./ts/destroy.support.ts","webpack://taggedjs/./ts/destroyTag.function.ts","webpack://taggedjs/./ts/elementDestroyCheck.function.ts","webpack://taggedjs/./ts/errors.ts","webpack://taggedjs/./ts/hasTagSupportChanged.function.ts","webpack://taggedjs/./ts/html.ts","webpack://taggedjs/./ts/insertAfter.function.ts","webpack://taggedjs/./ts/interpolations/bindSubjectCallback.function.ts","webpack://taggedjs/./ts/interpolations/elementInitCheck.ts","webpack://taggedjs/./ts/interpolations/inputAttribute.ts","webpack://taggedjs/./ts/interpolations/interpolateAttributes.ts","webpack://taggedjs/./ts/interpolations/interpolateContentTemplates.ts","webpack://taggedjs/./ts/interpolations/interpolateElement.ts","webpack://taggedjs/./ts/interpolations/interpolateTemplate.ts","webpack://taggedjs/./ts/interpolations/interpolations.ts","webpack://taggedjs/./ts/interpolations/processAttribute.function.ts","webpack://taggedjs/./ts/interpolations/scanTextAreaValue.function.ts","webpack://taggedjs/./ts/isInstance.ts","webpack://taggedjs/./ts/isLikeTags.function.ts","webpack://taggedjs/./ts/processNewValue.function.ts","webpack://taggedjs/./ts/processRegularValue.function.ts","webpack://taggedjs/./ts/processSubjectComponent.function.ts","webpack://taggedjs/./ts/processSubjectValue.function.ts","webpack://taggedjs/./ts/processTag.function.ts","webpack://taggedjs/./ts/processTagArray.ts","webpack://taggedjs/./ts/processTagResult.function.ts","webpack://taggedjs/./ts/render.ts","webpack://taggedjs/./ts/renderExistingTag.function.ts","webpack://taggedjs/./ts/renderTagSupport.function.ts","webpack://taggedjs/./ts/setTagPlaceholder.function.ts","webpack://taggedjs/./ts/state/callbackMaker.function.ts","webpack://taggedjs/./ts/state/index.ts","webpack://taggedjs/./ts/state/letState.function.ts","webpack://taggedjs/./ts/state/onDestroy.ts","webpack://taggedjs/./ts/state/onInit.ts","webpack://taggedjs/./ts/state/provider.utils.ts","webpack://taggedjs/./ts/state/providers.ts","webpack://taggedjs/./ts/state/setProp.function.ts","webpack://taggedjs/./ts/state/setUse.function.ts","webpack://taggedjs/./ts/state/state.function.ts","webpack://taggedjs/./ts/state/state.utils.ts","webpack://taggedjs/./ts/state/watch.function.ts","webpack://taggedjs/./ts/subject/Subject.class.ts","webpack://taggedjs/./ts/subject/ValueSubject.ts","webpack://taggedjs/./ts/subject/combineLatest.function.ts","webpack://taggedjs/./ts/subject/index.ts","webpack://taggedjs/./ts/subject/will.functions.ts","webpack://taggedjs/./ts/tag.ts","webpack://taggedjs/./ts/tagElement.ts","webpack://taggedjs/./ts/tagRunner.ts","webpack://taggedjs/./ts/updateBeforeTemplate.function.ts","webpack://taggedjs/./ts/updateContextItem.function.ts","webpack://taggedjs/./ts/updateExistingTagComponent.function.ts","webpack://taggedjs/./ts/updateExistingValue.function.ts","webpack://taggedjs/webpack/bootstrap","webpack://taggedjs/webpack/runtime/define property getters","webpack://taggedjs/webpack/runtime/hasOwnProperty shorthand","webpack://taggedjs/webpack/runtime/make namespace object","webpack://taggedjs/./ts/index.ts"],"sourcesContent":["export {};\n","export const variablePrefix = '__tagvar';\nexport const escapeVariable = '--' + variablePrefix + '--';\nexport const escapeSearch = new RegExp(escapeVariable, 'g');\nexport class Tag {\n strings;\n values;\n isTagClass = true;\n // present only when an array. Populated by Tag.key()\n memory = {};\n templater;\n constructor(strings, values) {\n this.strings = strings;\n this.values = values;\n }\n /** Used for array, such as array.map(), calls aka array.map(x => html``.key(x)) */\n key(arrayValue) {\n this.memory.arrayValue = arrayValue;\n return this;\n }\n}\n","import { escapeVariable, variablePrefix } from './Tag.class';\nimport { deepClone } from './deepFunctions';\nimport { isTagClass, isTagComponent, isTagTemplater } from './isInstance';\nimport { cloneValueArray } from './cloneValueArray.function';\nimport { restoreTagMarker } from './checkDestroyPrevious.function';\nimport { runBeforeDestroy } from './tagRunner';\nimport { getChildTagsToDestroy } from './destroy.support';\nimport { elementDestroyCheck } from './elementDestroyCheck.function';\nimport { updateContextItem } from './updateContextItem.function';\nimport { processNewValue } from './processNewValue.function';\nimport { setTagPlaceholder } from './setTagPlaceholder.function';\nimport { interpolateElement, interpolateString } from './interpolations/interpolateElement';\nimport { subscribeToTemplate } from './interpolations/interpolateTemplate';\nimport { afterInterpolateElement } from './afterInterpolateElement.function';\nconst prefixSearch = new RegExp(variablePrefix, 'g');\n/** used only for apps, otherwise use TagSupport */\nexport class BaseTagSupport {\n templater;\n subject;\n isApp = true;\n appElement; // only seen on this.getAppElement().appElement\n propsConfig;\n // stays with current render\n memory = {\n // context: {}, // populated after reading interpolated.values array converted to an object {variable0, variable:1}\n state: [],\n };\n // travels with all rerenderings\n global = {\n context: {}, // populated after reading interpolated.values array converted to an object {variable0, variable:1}\n providers: [],\n /** Indicator of re-rending. Saves from double rending something already rendered */\n renderCount: 0,\n deleted: false,\n subscriptions: []\n };\n constructor(templater, subject) {\n this.templater = templater;\n this.subject = subject;\n const children = templater.children; // children tags passed in as arguments\n const kidValue = children.value;\n const props = templater.props; // natural props\n const latestCloned = deepClone(props);\n this.propsConfig = {\n latest: props,\n latestCloned, // assume its HTML children and then detect\n lastClonedKidValues: kidValue.map(kid => {\n const cloneValues = cloneValueArray(kid.values);\n return cloneValues;\n })\n };\n // if the latest props are not HTML children, then clone the props for later render cycles to compare\n if (!isTagTemplater(props) && !isTagClass(props)) {\n this.propsConfig.latestCloned = deepClone(latestCloned);\n }\n }\n}\nexport class TagSupport extends BaseTagSupport {\n templater;\n ownerTagSupport;\n subject;\n version;\n isApp = false;\n hasLiveElements = false;\n childTags = []; // tags on me\n clones = []; // elements on document. Needed at destroy process to know what to destroy\n // may not be needed anymore?\n strings;\n values;\n lastTemplateString = undefined; // used to compare templates for updates\n constructor(templater, // at runtime rendering of a tag, it needs to be married to a new TagSupport()\n ownerTagSupport, subject, version = 0) {\n super(templater, subject);\n this.templater = templater;\n this.ownerTagSupport = ownerTagSupport;\n this.subject = subject;\n this.version = version;\n }\n destroy(options = {\n stagger: 0,\n byParent: false, // Only destroy clones of direct children\n }) {\n const global = this.global;\n const subject = this.subject;\n // put back down the template tag\n const insertBefore = global.insertBefore;\n if (insertBefore.nodeName === 'TEMPLATE') {\n const placeholder = global.placeholder;\n if (placeholder && !('arrayValue' in this.memory)) {\n if (!options.byParent) {\n restoreTagMarker(this, insertBefore);\n }\n }\n }\n delete global.placeholder;\n // the isComponent check maybe able to be removed\n const isComponent = isTagComponent(this) ? true : false;\n if (isComponent) {\n runBeforeDestroy(this, this);\n }\n const childTags = options.byParent ? [] : getChildTagsToDestroy(this.childTags);\n // signify that no further event rendering should take place by making logic think a render occurred during event\n // signify immediately child has been deleted (looked for during event processing)\n childTags.forEach(child => {\n const subGlobal = child.global;\n delete subGlobal.newest;\n subGlobal.deleted = true;\n });\n delete global.oldest;\n delete global.newest;\n global.deleted = true;\n this.hasLiveElements = false;\n delete subject.tagSupport;\n this.destroySubscriptions();\n let mainPromise;\n if (this.ownerTagSupport) {\n this.ownerTagSupport.childTags = this.ownerTagSupport.childTags.filter(child => child !== this);\n }\n if (!options.byParent) {\n const { stagger, promise } = this.destroyClones(options);\n options.stagger = stagger;\n if (promise) {\n mainPromise = promise;\n }\n }\n else {\n this.destroyClones();\n }\n if (mainPromise) {\n mainPromise = mainPromise.then(async () => {\n const promises = childTags.map(kid => kid.destroy({ stagger: 0, byParent: true }));\n return Promise.all(promises);\n });\n }\n else {\n mainPromise = Promise.all(childTags.map(kid => kid.destroy({ stagger: 0, byParent: true })));\n }\n return mainPromise.then(() => options.stagger);\n }\n destroySubscriptions() {\n const global = this.global;\n global.subscriptions.forEach(cloneSub => cloneSub.unsubscribe());\n global.subscriptions.length = 0;\n }\n destroyClones({ stagger } = {\n stagger: 0,\n }) {\n //const promises = this.clones.reverse().map(\n const promises = this.clones.map(clone => this.checkCloneRemoval(clone, stagger)).filter(x => x); // only return promises\n this.clones.length = 0; // tag maybe used for something else\n if (promises.length) {\n return { promise: Promise.all(promises), stagger };\n }\n return { stagger };\n }\n /** Reviews elements for the presences of ondestroy */\n checkCloneRemoval(clone, stagger) {\n let promise;\n const customElm = clone;\n if (customElm.ondestroy) {\n promise = elementDestroyCheck(customElm, stagger);\n }\n const next = () => {\n clone.parentNode?.removeChild(clone);\n const ownerSupport = this.ownerTagSupport;\n if (ownerSupport) {\n // Sometimes my clones were first registered to my owner, remove them from owner\n ownerSupport.clones = ownerSupport.clones.filter(compareClone => compareClone !== clone);\n }\n };\n if (promise instanceof Promise) {\n return promise.then(next);\n }\n else {\n next();\n }\n return promise;\n }\n update() {\n return this.updateContext(this.global.context);\n }\n updateBy(tagSupport) {\n const tempTag = tagSupport.templater.tag;\n this.updateConfig(tempTag.strings, tempTag.values);\n }\n updateConfig(strings, values) {\n this.strings = strings;\n this.updateValues(values);\n }\n updateValues(values) {\n this.values = values;\n return this.updateContext(this.global.context);\n }\n updateContext(context) {\n const thisTag = this.templater.tag;\n const strings = this.strings || thisTag.strings;\n const values = this.values || thisTag.values;\n strings.map((_string, index) => {\n const variableName = variablePrefix + index;\n const hasValue = values.length > index;\n const value = values[index];\n // is something already there?\n const exists = variableName in context;\n if (exists) {\n return updateContextItem(context, variableName, value);\n }\n if (!hasValue) {\n return;\n }\n // 🆕 First time values below\n context[variableName] = processNewValue(hasValue, value, this);\n });\n return context;\n }\n /** Function that kicks off actually putting tags down as HTML elements */\n buildBeforeElement(insertBefore, options = {\n forceElement: false,\n counts: { added: 0, removed: 0 },\n }) {\n const subject = this.subject;\n const global = this.global;\n global.insertBefore = insertBefore;\n if (!global.placeholder) {\n setTagPlaceholder(global);\n }\n const placeholderElm = global.placeholder;\n global.oldest = this;\n global.newest = this;\n subject.tagSupport = this;\n this.hasLiveElements = true;\n // remove old clones\n if (this.clones.length) {\n this.clones.forEach(clone => this.checkCloneRemoval(clone, 0));\n }\n global.insertBefore = insertBefore;\n const context = this.update();\n const template = this.getTemplate();\n const elementContainer = document.createElement('div');\n elementContainer.id = 'tag-temp-holder';\n // render content with a first child that we can know is our first element\n elementContainer.innerHTML = `<template id=\"temp-template-tag-wrap\">${template.string}</template>`;\n // Search/replace innerHTML variables but don't interpolate tag components just yet\n const { tagComponents } = interpolateElement(elementContainer, context, template, this, // ownerSupport,\n {\n forceElement: options.forceElement,\n counts: options.counts\n });\n afterInterpolateElement(elementContainer, placeholderElm, this, // ownerSupport\n context, options);\n // Any tag components that were found should be processed AFTER the owner processes its elements. Avoid double processing of elements attributes like (oninit)=${}\n let isForceElement = options.forceElement;\n tagComponents.forEach(tagComponent => {\n subscribeToTemplate(tagComponent.insertBefore, tagComponent.subject, tagComponent.ownerSupport, options.counts, { isForceElement });\n afterInterpolateElement(elementContainer, tagComponent.insertBefore, tagComponent.ownerSupport, // this, // ownerTag\n context, options);\n });\n }\n getTemplate() {\n const thisTag = this.templater.tag;\n const strings = this.strings || thisTag.strings;\n const values = this.values || thisTag.values;\n const string = strings.map((string, index) => {\n const safeString = string.replace(prefixSearch, escapeVariable);\n const endString = safeString + (values.length > index ? `{${variablePrefix}${index}}` : '');\n // const trimString = index === 0 || index === this.strings.length-1 ? endString.trim() : endString\n const trimString = endString.replace(/>\\s*/g, '>').replace(/\\s*</g, '<');\n return trimString;\n }).join('');\n const interpolation = interpolateString(string);\n this.lastTemplateString = interpolation.string;\n return {\n interpolation,\n // string,\n string: interpolation.string,\n strings,\n values,\n context: this.global.context || {},\n };\n }\n /** Used during HMR only where static content itself could have been edited */\n rebuild() {\n // const insertBefore = this.insertBefore\n const insertBefore = this.global.insertBefore;\n if (!insertBefore) {\n const err = new Error('Cannot rebuild. Previous insertBefore element is not defined on tag');\n err.tag = this;\n throw err;\n }\n this.buildBeforeElement(insertBefore, {\n forceElement: true,\n counts: { added: 0, removed: 0 },\n });\n }\n getAppElement() {\n let tag = this;\n while (tag.ownerTagSupport) {\n tag = tag.ownerTagSupport;\n }\n return tag;\n }\n}\n","import { runAfterRender, runBeforeRedraw, runBeforeRender } from './tagRunner';\nimport { setUse } from './state';\nimport { isLikeTags } from './isLikeTags.function';\nimport { destroyTagMemory } from './destroyTag.function';\nexport class TemplaterResult {\n props;\n children;\n isTemplater = true;\n tagged;\n wrapper;\n tag;\n constructor(props, children) {\n this.props = props;\n this.children = children;\n }\n}\nexport function renderWithSupport(tagSupport, // new\nlastSupport, // previous\nsubject, // events & memory\nownerSupport) {\n /* BEFORE RENDER */\n const lastOwnerSupport = lastSupport?.ownerTagSupport;\n const runtimeOwnerSupport = lastOwnerSupport || ownerSupport;\n if (lastSupport) {\n const lastState = lastSupport.memory.state;\n const memory = tagSupport.memory;\n memory.state = [...lastState];\n tagSupport.global = lastSupport.global;\n runBeforeRedraw(tagSupport, lastSupport);\n }\n else {\n // first time render\n runBeforeRender(tagSupport, runtimeOwnerSupport);\n // TODO: Logic below most likely could live within providers.ts inside the runBeforeRender function\n const providers = setUse.memory.providerConfig;\n providers.ownerSupport = runtimeOwnerSupport;\n }\n /* END: BEFORE RENDER */\n const templater = tagSupport.templater;\n const subTag = subject.tagSupport;\n // NEW TAG CREATED HERE\n const wrapper = templater.wrapper;\n const reSupport = wrapper(tagSupport, subject);\n /* AFTER */\n runAfterRender(tagSupport, reSupport);\n const isLikeTag = !lastSupport || isLikeTags(lastSupport, reSupport);\n if (!isLikeTag) {\n destroyUnlikeTags(lastSupport, reSupport, subject);\n }\n reSupport.ownerTagSupport = (ownerSupport || lastOwnerSupport);\n tagSupport.global.newest = reSupport;\n return reSupport;\n}\nfunction destroyUnlikeTags(lastSupport, // old\nreSupport, // new\nsubject) {\n const oldGlobal = lastSupport.global;\n const insertBefore = oldGlobal.insertBefore;\n destroyTagMemory(lastSupport, subject);\n // when a tag is destroyed, disconnect the globals\n reSupport.global = { ...oldGlobal }; // break memory references\n const global = reSupport.global;\n global.insertBefore = insertBefore;\n global.deleted = false;\n delete global.oldest;\n delete global.newest;\n delete subject.tagSupport;\n}\n","import { buildClones } from './render';\nimport { afterElmBuild } from './interpolations/interpolateTemplate';\nexport function afterInterpolateElement(container, insertBefore, tagSupport, \n// preClones: Clones,\ncontext, options) {\n const clones = buildClones(container, insertBefore);\n if (!clones.length) {\n return clones;\n }\n clones.forEach(clone => afterElmBuild(clone, options, context, tagSupport));\n tagSupport.clones.push(...clones);\n return clones;\n}\n","import { isTag } from './isInstance';\nimport { renderTagSupport } from './renderTagSupport.function';\n/* Used to rewrite props that are functions. When they are called it should cause parent rendering */\nexport function alterProps(props, ownerSupport) {\n function callback(toCall, callWith) {\n return callbackPropOwner(toCall, callWith, ownerSupport);\n }\n const isPropTag = isTag(props);\n const watchProps = isPropTag ? 0 : props;\n const newProps = resetFunctionProps(watchProps, callback);\n return newProps;\n}\nfunction resetFunctionProps(props, callback) {\n if (typeof (props) !== 'object') {\n return props;\n }\n const newProps = props;\n // BELOW: Do not clone because if first argument is object, the memory ref back is lost\n // const newProps = {...props} \n Object.entries(newProps).forEach(([name, value]) => {\n if (value instanceof Function) {\n const original = newProps[name].original;\n if (original) {\n return; // already previously converted\n }\n newProps[name] = (...args) => {\n return newProps[name].toCall(...args); // what gets called can switch over parent state changes\n };\n // Currently, call self but over parent state changes, I may need to call a newer parent tag owner\n newProps[name].toCall = (...args) => callback(value, args);\n newProps[name].original = value;\n return;\n }\n });\n return newProps;\n}\nexport function callbackPropOwner(toCall, callWith, ownerSupport) {\n const callbackResult = toCall(...callWith);\n const lastestOwner = ownerSupport.global.newest;\n renderTagSupport(lastestOwner, true);\n return callbackResult;\n}\n","import { isTag, isTagArray, isTagComponent } from './isInstance';\nimport { isLikeTags } from './isLikeTags.function';\nimport { destroyTagMemory, destroyTagSupportPast } from './destroyTag.function';\nimport { insertAfter } from './insertAfter.function';\nexport function checkDestroyPrevious(subject, // existing.value is the old value\nnewValue, insertBefore) {\n const arraySubject = subject;\n const wasArray = arraySubject.lastArray;\n // no longer an array\n if (wasArray && !isTagArray(newValue)) {\n const placeholderElm = arraySubject.placeholder;\n delete arraySubject.lastArray;\n delete arraySubject.placeholder;\n insertAfter(insertBefore, placeholderElm);\n wasArray.forEach(({ tagSupport }) => destroyArrayTag(tagSupport, { added: 0, removed: 0 }));\n return 'array';\n }\n const tagSubject = subject;\n const lastSupport = tagSubject.tagSupport;\n // no longer tag or component?\n if (lastSupport) {\n const isValueTag = isTag(newValue);\n const isSubjectTag = isTag(subject.value);\n if (isSubjectTag && isValueTag) {\n const newTag = newValue;\n // its a different tag now\n if (!isLikeTags(newTag, lastSupport)) {\n // put template back down\n restoreTagMarker(lastSupport, insertBefore);\n destroyTagMemory(lastSupport, tagSubject);\n return 2;\n }\n return false;\n }\n const isValueTagComponent = isTagComponent(newValue);\n if (isValueTagComponent) {\n return false; // its still a tag component\n }\n // put template back down\n restoreTagMarker(lastSupport, insertBefore);\n // destroy old component, value is not a component\n destroyTagMemory(lastSupport, tagSubject);\n return 'different-tag';\n }\n const displaySubject = subject;\n const hasLastValue = 'lastValue' in displaySubject;\n const lastValue = displaySubject.lastValue; // TODO: we maybe able to use displaySubject.value and remove concept of lastValue\n // was simple value but now something bigger\n if (hasLastValue && lastValue !== newValue) {\n destroySimpleValue(insertBefore, displaySubject);\n return 'changed-simple-value';\n }\n return false;\n}\nexport function destroyArrayTag(tagSupport, counts) {\n destroyTagSupportPast(tagSupport);\n tagSupport.destroy({\n stagger: counts.removed++,\n });\n const insertBefore = tagSupport.global.insertBefore;\n const parentNode = insertBefore.parentNode;\n parentNode.removeChild(insertBefore);\n}\nfunction destroySimpleValue(insertBefore, // always a template tag\nsubject) {\n const clone = subject.clone;\n const parent = clone.parentNode;\n // 1 put the template back down\n parent.insertBefore(insertBefore, clone);\n parent.removeChild(clone);\n delete subject.clone;\n delete subject.lastValue;\n}\nexport function restoreTagMarker(lastSupport, insertBefore) {\n const global = lastSupport.global;\n const placeholderElm = global.placeholder;\n if (placeholderElm) {\n insertAfter(insertBefore, placeholderElm);\n }\n}\n","import { deepClone } from './deepFunctions';\nimport { isTagArray, isTagClass, isTagComponent, isTagTemplater } from './isInstance';\nexport function cloneValueArray(values) {\n return values.map((value) => {\n const tag = value;\n if (isTagComponent(value)) {\n const tagComponent = value;\n return deepClone(tagComponent.props);\n }\n if (isTagClass(tag) || isTagTemplater(tag)) {\n return cloneValueArray(tag.values);\n }\n if (isTagArray(tag)) {\n return cloneValueArray(tag);\n }\n return deepClone(value);\n });\n}\n","export function deepClone(obj) {\n return makeDeepClone(obj, new WeakMap());\n}\nfunction makeDeepClone(obj, visited) {\n // If obj is a primitive type or null, return it directly\n if (obj === null || typeof obj !== 'object') {\n return obj;\n }\n // If obj is already visited, return the cloned reference\n if (visited.has(obj)) {\n return visited.get(obj);\n }\n // Handle special cases like Date and RegExp\n if (obj instanceof Date) {\n return new Date(obj);\n }\n if (obj instanceof RegExp) {\n return new RegExp(obj);\n }\n // Create an empty object or array with the same prototype\n const clone = Array.isArray(obj) ? [] : Object.create(Object.getPrototypeOf(obj));\n // Register the cloned object to avoid cyclic references\n visited.set(obj, clone);\n // Clone each property or element of the object or array\n if (Array.isArray(obj)) {\n for (let i = 0; i < obj.length; i++) {\n clone[i] = makeDeepClone(obj[i], visited);\n }\n }\n else {\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n clone[key] = makeDeepClone(obj[key], visited);\n }\n }\n }\n return clone;\n}\nexport function deepEqual(obj1, obj2) {\n return isDeepEqual(obj1, obj2, new WeakMap());\n}\nfunction isDeepEqual(obj1, obj2, visited) {\n const directEqual = obj1 === obj2;\n if (directEqual || isSameFunctions(obj1, obj2)) {\n return true;\n }\n // If obj is already visited, return the cloned reference\n if (visited.has(obj1)) {\n return true;\n }\n if (typeof obj1 === 'object' && typeof obj2 === 'object') {\n // both are dates and were already determined not the same\n if (obj1 instanceof Date && obj2 instanceof Date) {\n return false;\n }\n // Register the cloned object to avoid cyclic references\n visited.set(obj1, 0);\n // Check if obj1 and obj2 are both arrays\n if (Array.isArray(obj1) && Array.isArray(obj2)) {\n return isArrayDeepEqual(obj1, obj2, visited);\n }\n else if (Array.isArray(obj1) || Array.isArray(obj2)) {\n // One is an array, and the other is not\n return false;\n }\n return isObjectDeepEqual(obj1, obj2, visited);\n }\n return false;\n}\nfunction isObjectDeepEqual(obj1, obj2, visited) {\n const keys1 = Object.keys(obj1);\n const keys2 = Object.keys(obj2);\n if (keys1.length === 0 && keys2.length === 0) {\n return true;\n }\n if (keys1.length !== keys2.length) {\n return false;\n }\n for (const key of keys1) {\n const keyFound = keys2.includes(key);\n if (!keyFound || !isDeepEqual(obj1[key], obj2[key], visited)) {\n return false;\n }\n }\n return true;\n}\nfunction isArrayDeepEqual(obj1, obj2, visited) {\n if (obj1.length !== obj2.length) {\n return false;\n }\n for (let i = 0; i < obj1.length; i++) {\n if (!isDeepEqual(obj1[i], obj2[i], visited)) {\n return false;\n }\n }\n return true;\n}\nfunction isSameFunctions(fn0, fn1) {\n const bothFunction = fn0 instanceof Function && fn1 instanceof Function;\n return bothFunction && fn0.toString() === fn1.toString();\n}\n","export function getChildTagsToDestroy(childTags, allTags = []) {\n for (let index = childTags.length - 1; index >= 0; --index) {\n const cTag = childTags[index];\n allTags.push(cTag);\n childTags.splice(index, 1);\n getChildTagsToDestroy(cTag.childTags, allTags);\n }\n return allTags;\n}\n","export function destroyTagMemory(oldTagSupport, subject) {\n delete subject.tagSupport;\n delete oldTagSupport.subject.tagSupport; // TODO: this line maybe not needed\n // must destroy oldest which is tag with elements on stage\n const oldest = oldTagSupport.global.oldest;\n oldest.destroy();\n destroyTagSupportPast(oldTagSupport);\n oldTagSupport.global.context = {};\n}\nexport function destroyTagSupportPast(oldTagSupport) {\n delete oldTagSupport.global.oldest;\n delete oldTagSupport.global.newest;\n}\n","export function elementDestroyCheck(nextSibling, stagger) {\n const onDestroyDoubleWrap = nextSibling.ondestroy;\n if (!onDestroyDoubleWrap) {\n return;\n }\n const onDestroyWrap = onDestroyDoubleWrap.tagFunction;\n if (!onDestroyWrap) {\n return;\n }\n const onDestroy = onDestroyWrap.tagFunction;\n if (!onDestroy) {\n return;\n }\n const event = { target: nextSibling, stagger };\n return onDestroy(event);\n}\n","export class TagError extends Error {\n details;\n constructor(message, errorCode, details = {}) {\n super(message);\n this.name = TagError.name;\n this.details = { ...details, errorCode };\n }\n}\nexport class ArrayNoKeyError extends TagError {\n constructor(message, details) {\n super(message, 'array-no-key-error', details);\n this.name = ArrayNoKeyError.name;\n }\n}\nexport class StateMismatchError extends TagError {\n constructor(message, details) {\n super(message, 'state-mismatch-error', details);\n this.name = StateMismatchError.name;\n }\n}\nexport class SyncCallbackError extends TagError {\n constructor(message, details) {\n super(message, 'sync-callback-error', details);\n this.name = SyncCallbackError.name;\n }\n}\n","import { deepEqual } from \"./deepFunctions\";\nexport function hasTagSupportChanged(oldTagSupport, newTagSupport, newTemplater) {\n const latestProps = newTemplater.props; // newTagSupport.propsConfig.latest\n const pastCloneProps = oldTagSupport.propsConfig.latestCloned;\n const propsChanged = hasPropChanges(latestProps, pastCloneProps);\n // if no changes detected, no need to continue to rendering further tags\n if (propsChanged) {\n return propsChanged;\n }\n const kidsChanged = hasKidsChanged(oldTagSupport, newTagSupport);\n // we already know props didn't change and if kids didn't either, than don't render\n return kidsChanged;\n}\nexport function hasPropChanges(props, // natural props\npastCloneProps) {\n /*\n const isCommonEqual = props === undefined && props === compareToProps\n if(isCommonEqual) {\n return false\n }\n */\n let castedProps = props;\n let castedPastProps = pastCloneProps;\n // check all prop functions match\n if (typeof (props) === 'object') {\n if (!pastCloneProps) {\n return 3;\n }\n castedProps = { ...props };\n castedPastProps = { ...(pastCloneProps || {}) };\n const allFunctionsMatch = Object.entries(castedProps).every(([key, value]) => {\n let compare = castedPastProps[key];\n if (!(value instanceof Function)) {\n return 4; // this will be checked in deepEqual\n }\n if (!(compare instanceof Function)) {\n return false; // its a function now but was not before\n }\n // ensure we are comparing apples to apples as function get wrapped\n if (compare.original) {\n compare = compare.original;\n }\n const original = value.original;\n if (original) {\n value = value.original;\n }\n if (value.toString() !== compare.toString()) {\n return false; // both are function but not the same\n }\n delete castedProps[key]; // its a function and not needed to be compared\n delete castedPastProps[key]; // its a function and not needed to be compared\n return 5;\n });\n if (!allFunctionsMatch) {\n return 6; // a change has been detected by function comparisons\n }\n }\n const isEqual = deepEqual(castedPastProps, castedProps);\n return isEqual ? false : 7; // if equal then no changes\n}\nexport function hasKidsChanged(oldTagSupport, newTagSupport) {\n const oldCloneKidValues = oldTagSupport.propsConfig.lastClonedKidValues;\n const newClonedKidValues = newTagSupport.propsConfig.lastClonedKidValues;\n const everySame = oldCloneKidValues.every((set, index) => {\n const x = newClonedKidValues[index];\n return set.every((item, index) => item === x[index]);\n });\n return everySame ? false : 9;\n}\n","import { Tag } from \"./Tag.class\";\nexport function html(strings, ...values) {\n return new Tag(strings, values);\n}\n","// Function to insert element after reference element\nexport function insertAfter(newNode, referenceNode) {\n const parentNode = referenceNode.parentNode;\n parentNode.insertBefore(newNode, referenceNode.nextSibling);\n}\n","/** File largely responsible for reacting to element events, such as onclick */\nimport { renderTagSupport } from \"../renderTagSupport.function\";\nexport function bindSubjectCallback(value, tagSupport) {\n // Is this children? No override needed\n if (value.isChildOverride) {\n return value;\n }\n const subjectFunction = (element, args) => runTagCallback(value, tagSupport, element, args);\n // link back to original. Mostly used for <div oninit ondestroy> animations\n subjectFunction.tagFunction = value;\n return subjectFunction;\n}\nexport function runTagCallback(value, tagSupport, bindTo, args) {\n const renderCount = tagSupport.global.renderCount;\n const method = value.bind(bindTo);\n const callbackResult = method(...args);\n const sameRenderCount = renderCount === tagSupport.global.renderCount;\n // already rendered OR tag was deleted before event processing\n if (!sameRenderCount || tagSupport.global.deleted) {\n if (callbackResult instanceof Promise) {\n return callbackResult.then(() => {\n return 'promise-no-data-ever'; // tag was deleted during event processing\n });\n }\n return 'no-data-ever'; // already rendered\n }\n renderTagSupport(tagSupport, true);\n if (callbackResult instanceof Promise) {\n return callbackResult.then(() => {\n if (tagSupport.global.deleted) {\n return 'promise-no-data-ever'; // tag was deleted during event processing\n }\n renderTagSupport(tagSupport, true);\n return 'promise-no-data-ever';\n });\n }\n // Caller always expects a Promise\n return 'no-data-ever';\n}\n","export function elementInitCheck(nextSibling, counts) {\n const onInitDoubleWrap = nextSibling.oninit;\n if (!onInitDoubleWrap) {\n return counts.added;\n }\n const onInitWrap = onInitDoubleWrap.tagFunction;\n if (!onInitWrap) {\n return counts.added;\n }\n const onInit = onInitWrap.tagFunction;\n if (!onInit) {\n return counts.added;\n }\n const event = { target: nextSibling, stagger: counts.added };\n onInit(event);\n return ++counts.added;\n}\n","export function inputAttribute(name, value, element) {\n const names = name.split('.');\n // style.position = \"absolute\"\n if (names[0] === 'style') {\n element.style[names[1]] = value;\n }\n // Example: class.width-full = \"true\"\n if (names[0] === 'class') {\n names.shift();\n if (value) {\n names.forEach(name => element.classList.add(name));\n }\n else {\n names.forEach(name => element.classList.remove(name));\n }\n return;\n }\n}\n","import { processAttribute } from \"./processAttribute.function\";\nfunction howToSetAttribute(element, name, value) {\n element.setAttribute(name, value);\n}\nfunction howToSetInputValue(element, name, value) {\n element[name] = value;\n}\nexport function interpolateAttributes(child, scope, ownerSupport) {\n const attrNames = child.getAttributeNames();\n let howToSet = howToSetAttribute;\n attrNames.forEach(attrName => {\n if (child.nodeName === 'INPUT' && attrName === 'value') {\n howToSet = howToSetInputValue;\n }\n const value = child.getAttribute(attrName);\n processAttribute(attrName, value, child, scope, ownerSupport, howToSet);\n howToSet = howToSetAttribute; // put back\n });\n}\n","import { interpolateTemplate } from \"./interpolateTemplate\";\nexport function interpolateContentTemplates(element, context, tagSupport, options, children) {\n if (!children || element.tagName === 'TEMPLATE') {\n return { clones: [], tagComponents: [] }; // done\n }\n // counting for animation stagger computing\n const counts = options.counts;\n const clones = [];\n const tagComponents = [];\n const childArray = new Array(...children);\n childArray.forEach(child => {\n const { clones: nextClones, tagComponent } = interpolateTemplate(child, context, tagSupport, counts, options);\n clones.push(...nextClones);\n if (tagComponent) {\n tagComponents.push(tagComponent);\n return;\n }\n if (child.children) {\n const nextKids = new Array(...child.children);\n nextKids.forEach((subChild, index) => {\n // IF <template end /> its a variable to be processed\n if (isRenderEndTemplate(subChild)) {\n const { tagComponent } = interpolateTemplate(subChild, context, tagSupport, counts, options);\n if (tagComponent) {\n tagComponents.push(tagComponent);\n }\n }\n const { clones: nextClones, tagComponents: nextTagComponent } = interpolateContentTemplates(subChild, context, tagSupport, options, subChild.children);\n clones.push(...nextClones);\n tagComponents.push(...nextTagComponent);\n });\n }\n });\n return { clones, tagComponents };\n}\nfunction isRenderEndTemplate(child) {\n const isTemplate = child.tagName === 'TEMPLATE';\n return isTemplate &&\n child.getAttribute('interpolate') !== undefined &&\n child.getAttribute('end') !== undefined;\n}\n","import { interpolateAttributes } from \"./interpolateAttributes\";\nimport { interpolateToTemplates } from \"./interpolations\";\nimport { interpolateContentTemplates } from \"./interpolateContentTemplates\";\nimport { escapeSearch, variablePrefix } from \"../Tag.class\";\n/** Review elements within an element */\nexport function interpolateElement(container, // element containing innerHTML to review interpolations\ncontext, // variables used to evaluate\ninterpolatedTemplates, ownerSupport, options) {\n const clones = [];\n const tagComponents = [];\n const result = interpolatedTemplates.interpolation;\n const template = container.children[0];\n const children = template.content.children;\n if (result.keys.length) {\n const { clones: nextClones, tagComponents: nextTagComponents } = interpolateContentTemplates(container, context, ownerSupport, options, children);\n clones.push(...nextClones);\n tagComponents.push(...nextTagComponents);\n }\n interpolateAttributes(container, context, ownerSupport);\n processChildrenAttributes(children, context, ownerSupport);\n return { clones, tagComponents };\n}\nfunction processChildrenAttributes(children, context, ownerSupport) {\n new Array(...children).forEach(child => {\n interpolateAttributes(child, context, ownerSupport);\n if (child.children) {\n processChildrenAttributes(child.children, context, ownerSupport);\n }\n });\n}\nexport function interpolateString(string) {\n const result = interpolateToTemplates(string);\n result.string = result.string.replace(escapeSearch, variablePrefix);\n return result;\n}\n","import { variablePrefix } from \"../Tag.class\";\nimport { elementInitCheck } from \"./elementInitCheck\";\nimport { processSubjectValue } from \"../processSubjectValue.function\";\nimport { isTagArray, isTagComponent } from \"../isInstance\";\nimport { scanTextAreaValue } from \"./scanTextAreaValue.function\";\nimport { updateExistingValue } from \"../updateExistingValue.function\";\nexport function interpolateTemplate(insertBefore, // <template end interpolate /> (will be removed)\ncontext, // variable scope of {`__tagvar${index}`:'x'}\nownerSupport, // Tag class\ncounts, // used for animation stagger computing\noptions) {\n // TODO: THe clones array is useless here\n const clones = [];\n if (!insertBefore.hasAttribute('end')) {\n return { clones }; // only care about <template end>\n }\n const variableName = insertBefore.getAttribute('id');\n if (variableName?.substring(0, variablePrefix.length) !== variablePrefix) {\n return { clones }; // ignore, not a tagVar\n }\n const existingSubject = context[variableName];\n const isDynamic = isTagComponent(existingSubject.value) || isTagArray(existingSubject.value);\n // process dynamics later\n if (isDynamic) {\n return {\n clones,\n tagComponent: {\n variableName,\n ownerSupport,\n subject: existingSubject,\n insertBefore\n }\n };\n }\n let isForceElement = options.forceElement;\n subscribeToTemplate(insertBefore, existingSubject, ownerSupport, counts, { isForceElement });\n return { clones };\n}\nexport function subscribeToTemplate(insertBefore, subject, ownerSupport, counts, // used for animation stagger computing\n{ isForceElement }) {\n let called = false;\n const callback = (value) => {\n if (called) {\n updateExistingValue(subject, value, ownerSupport, insertBefore);\n return;\n }\n const templater = value;\n processSubjectValue(templater, subject, insertBefore, ownerSupport, {\n counts: { ...counts },\n forceElement: isForceElement,\n });\n if (isForceElement) {\n isForceElement = false; // only can happen once\n }\n called = true;\n };\n const sub = subject.subscribe(callback);\n ownerSupport.global.subscriptions.push(sub);\n}\nexport function afterElmBuild(elm, options, context, ownerSupport) {\n if (!elm.getAttribute) {\n return;\n }\n const tagName = elm.nodeName; // elm.tagName\n if (tagName === 'TEXTAREA') {\n scanTextAreaValue(elm, context, ownerSupport);\n }\n let diff = options.counts.added;\n diff = elementInitCheck(elm, options.counts) - diff;\n if (elm.children) {\n new Array(...elm.children).forEach((child, index) => {\n const subOptions = {\n ...options,\n counts: options.counts,\n };\n return afterElmBuild(child, subOptions, context, ownerSupport);\n });\n }\n}\n","// support arrow functions in attributes\nexport const interpolateReplace = /(?:<[^>]*?(?:(?:\\s+\\w+(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^>\\s]+)))*\\s*)\\/?>)|({__tagvar[^}]+})/g;\n/** replaces ${x} with <template id=\"x-start\"></template><template id=\"x-end\"></template> */\nexport function interpolateToTemplates(template) {\n const keys = [];\n const string = template.replace(interpolateReplace, (match, expression) => {\n if (match.startsWith('<')) {\n // If the match is an HTML tag, don't replace\n return match;\n }\n const noBraces = expression.substring(1, expression.length - 1);\n const id = noBraces;\n keys.push(id);\n return `<template interpolate end id=\"${id}\"></template>`;\n });\n return { string, keys };\n}\n","import { inputAttribute } from './inputAttribute';\nimport { isSubjectInstance } from '../isInstance';\nimport { bindSubjectCallback } from './bindSubjectCallback.function';\nconst startRegX = /^\\s*{__tagvar/;\nconst endRegX = /}\\s*$/;\nfunction isTagVar(value) {\n return value && value.search(startRegX) >= 0 && value.search(endRegX) >= 0;\n}\nexport function processAttribute(attrName, value, child, scope, ownerSupport, howToSet) {\n if (isTagVar(value)) {\n return processScopedNameValueAttr(attrName, value, child, scope, ownerSupport, howToSet);\n }\n if (isTagVar(attrName)) {\n const contextValueSubject = getContextValueByVarString(scope, attrName);\n let lastValue;\n // the above callback gets called immediately since its a ValueSubject()\n const sub = contextValueSubject.subscribe((value) => {\n processNameOnlyAttr(value, lastValue, child, ownerSupport, howToSet);\n lastValue = value;\n });\n ownerSupport.global.subscriptions.push(sub); // this is where unsubscribe is picked up\n child.removeAttribute(attrName);\n return;\n }\n // Non dynamic\n const isSpecial = isSpecialAttr(attrName);\n if (isSpecial) {\n return inputAttribute(attrName, value, child);\n }\n}\nfunction processScopedNameValueAttr(attrName, value, // {__tagVarN}\nchild, scope, ownerSupport, howToSet) {\n // get the code inside the brackets like \"variable0\" or \"{variable0}\"\n const result = getContextValueByVarString(scope, value);\n return processNameValueAttr(attrName, result, child, ownerSupport, howToSet);\n}\nfunction getContextValueByVarString(scope, value) {\n const code = value.replace('{', '').split('').reverse().join('').replace('}', '').split('').reverse().join('');\n return scope[code];\n}\nfunction processNameOnlyAttr(attrValue, lastValue, child, ownerSupport, howToSet) {\n if (lastValue && lastValue != attrValue) {\n if (typeof (lastValue) === 'string') {\n child.removeAttribute(lastValue);\n }\n else if (lastValue instanceof Object) {\n Object.entries(lastValue).forEach(([name]) => child.removeAttribute(name));\n }\n }\n if (typeof (attrValue) === 'string') {\n if (!attrValue.length) {\n return;\n }\n processNameValueAttr(attrValue, '', child, ownerSupport, howToSet);\n return;\n }\n if (attrValue instanceof Object) {\n Object.entries(attrValue).forEach(([name, value]) => processNameValueAttr(name, value, child, ownerSupport, howToSet));\n return;\n }\n}\nfunction processNameValueAttr(attrName, result, child, ownerSupport, howToSet) {\n const isSpecial = isSpecialAttr(attrName);\n // attach as callback?\n if (result instanceof Function) {\n const action = function (...args) {\n const result2 = result(child, args);\n return result2;\n };\n child[attrName].action = action;\n // child.addEventListener(attrName, action)\n }\n // Most every variable comes in here since everything is made a ValueSubject\n if (isSubjectInstance(result)) {\n child.removeAttribute(attrName);\n const callback = (newAttrValue) => {\n if (newAttrValue instanceof Function) {\n newAttrValue = bindSubjectCallback(newAttrValue, ownerSupport);\n }\n return processAttributeSubjectValue(newAttrValue, child, attrName, isSpecial, howToSet);\n };\n // 🗞️ Subscribe. Above callback called immediately since its a ValueSubject()\n const sub = result.subscribe(callback);\n // Record subscription for later unsubscribe when element destroyed\n ownerSupport.global.subscriptions.push(sub);\n return;\n }\n howToSet(child, attrName, result);\n // child.setAttribute(attrName, result.value)\n return;\n}\nfunction processAttributeSubjectValue(newAttrValue, child, attrName, isSpecial, howToSet) {\n if (newAttrValue instanceof Function) {\n const fun = function (...args) {\n return newAttrValue(child, args);\n };\n // access to original function\n fun.tagFunction = newAttrValue;\n child[attrName] = fun;\n return;\n }\n if (isSpecial) {\n inputAttribute(attrName, newAttrValue, child);\n return;\n }\n if (newAttrValue) {\n howToSet(child, attrName, newAttrValue);\n return;\n }\n const isDeadValue = [undefined, false, null].includes(newAttrValue);\n if (isDeadValue) {\n child.removeAttribute(attrName);\n return;\n }\n // value is 0\n howToSet(child, attrName, newAttrValue);\n}\n/** Looking for (class | style) followed by a period */\nfunction isSpecialAttr(attrName) {\n return attrName.search(/^(class|style)(\\.)/) >= 0;\n}\n","import { processAttribute } from './processAttribute.function';\nconst search = new RegExp('\\\\s*<template interpolate end id=\"__tagvar(\\\\d{1,4})\"([^>]*)></template>(\\\\s*)');\nexport function scanTextAreaValue(textarea, context, ownerSupport) {\n const value = textarea.value;\n if (value.search(search) >= 0) {\n const match = value.match(/__tagvar(\\d{1,4})/);\n const token = match ? match[0] : '';\n const dynamic = '{' + token + '}';\n textarea.value = '';\n textarea.setAttribute('text-var-value', dynamic);\n const howToSet = (_elm, _name, value) => textarea.value = value;\n processAttribute('text-var-value', dynamic, // realValue, // context[token].value,\n textarea, context, ownerSupport, howToSet);\n }\n}\n","export function isTagComponent(value) {\n return value?.wrapper?.original instanceof Function;\n}\nexport function isTag(value) {\n return isTagTemplater(value) || isTagClass(value);\n}\nexport function isTagTemplater(value) {\n const templater = value;\n return templater?.isTemplater === true && templater.wrapper === undefined;\n}\nexport function isTagClass(value) {\n const templater = value;\n return templater?.isTagClass === true;\n}\nexport function isSubjectInstance(subject) {\n return (subject?.isSubject === true || subject?.subscribe) ? true : false; // subject?.isSubject === true || \n}\nexport function isTagArray(value) {\n return value instanceof Array && value.every(x => isTagClass(x) || isTagTemplater(x));\n}\n","export function isLikeTags(tagSupport0, // new\ntagSupport1) {\n const templater0 = tagSupport0.templater;\n const templater1 = tagSupport1.templater;\n const tag0 = templater0?.tag || tagSupport0;\n const tag1 = templater1.tag;\n const strings0 = tag0.strings;\n const strings1 = tagSupport1.strings || tag1.strings;\n if (strings0.length !== strings1.length) {\n return false;\n }\n const everyStringMatched = strings0.every((string, index) => strings1[index] === string);\n if (!everyStringMatched) {\n return false;\n }\n const values0 = tagSupport0.values || tag0.values;\n const values1 = tagSupport1.values || tag1.values;\n const valuesLengthsMatch = values0.length === values1.length;\n if (!valuesLengthsMatch) {\n return false;\n }\n const allVarsMatch = values1.every((value, index) => {\n const compareTo = values0[index];\n const isFunctions = value instanceof Function && compareTo instanceof Function;\n if (isFunctions) {\n const stringMatch = value.toString() === compareTo.toString();\n if (stringMatch) {\n return true;\n }\n return false;\n }\n return true; // deepEqual(value, compareTo)\n });\n if (allVarsMatch) {\n return true;\n }\n return false;\n}\n","import { ValueSubject } from './subject/ValueSubject';\nimport { isSubjectInstance, isTagClass, isTagComponent, isTagTemplater } from './isInstance';\nimport { TemplaterResult } from './TemplaterResult.class';\nimport { TagSupport } from './TagSupport.class';\nexport function processNewValue(hasValue, value, ownerSupport) {\n if (isTagComponent(value)) {\n const tagSubject = new ValueSubject(value);\n return tagSubject;\n }\n if (value instanceof Function) {\n return new ValueSubject(value);\n }\n if (!hasValue) {\n return new ValueSubject(undefined);\n }\n if (isTagTemplater(value)) {\n const templater = value;\n const tag = templater.tag;\n return processNewTag(tag, ownerSupport);\n }\n if (isTagClass(value)) {\n return processNewTag(value, ownerSupport);\n }\n // is already a value subject?\n if (isSubjectInstance(value)) {\n return value;\n }\n return new ValueSubject(value);\n}\nfunction processNewTag(value, ownerSupport) {\n const tag = value;\n let templater = tag.templater;\n if (!templater) {\n const children = new ValueSubject([]);\n templater = new TemplaterResult(undefined, children);\n templater.tag = tag;\n tag.templater = templater;\n }\n const subject = new ValueSubject(templater);\n const tagSupport = subject.tagSupport = new TagSupport(templater, ownerSupport, subject);\n return subject;\n}\n","import { updateBeforeTemplate } from './updateBeforeTemplate.function';\nexport function processRegularValue(value, subject, // could be tag via subject.tag\ninsertBefore) {\n subject.insertBefore = insertBefore;\n const before = subject.clone || insertBefore; // Either the template is on the doc OR its the first element we last put on doc\n // matches but also was defined at some point\n if (subject.lastValue === value && 'lastValue' in subject) {\n return; // no need to update display, its the same\n }\n subject.lastValue = value;\n // Processing of regular values\n const clone = updateBeforeTemplate(value, before);\n subject.clone = clone; // remember single element put down, for future updates\n}\n","import { renderWithSupport } from './TemplaterResult.class';\nimport { setUse } from './state';\nimport { processTagResult } from './processTagResult.function';\nimport { TagSupport } from './TagSupport.class';\nexport function processSubjectComponent(templater, subject, insertBefore, ownerSupport, options) {\n // Check if function component is wrapped in a tag() call\n // TODO: This below check not needed in production mode\n if (templater.tagged !== true) {\n const wrapper = templater.wrapper;\n const original = wrapper.original;\n let name = original.name || original.constructor?.name;\n if (name === 'Function') {\n name = undefined;\n }\n const label = name || original.toString().substring(0, 120);\n const error = new Error(`Not a tag component. Wrap your function with tag(). Example tag(props => html\\`\\`) on component:\\n\\n${label}\\n\\n`);\n throw error;\n }\n const tagSupport = new TagSupport(templater, ownerSupport, subject);\n let reSupport = subject.tagSupport;\n const global = tagSupport.global = reSupport?.global || tagSupport.global;\n global.insertBefore = insertBefore;\n const providers = setUse.memory.providerConfig;\n providers.ownerSupport = ownerSupport;\n const isRender = !reSupport || options.forceElement;\n if (isRender) {\n const support = reSupport || tagSupport;\n reSupport = renderSubjectComponent(subject, support, ownerSupport);\n }\n processTagResult(reSupport, subject, // The element set here will be removed from document. Also result.tag will be added in here\n insertBefore, // <template end interpolate /> (will be removed)\n options);\n return reSupport;\n}\nfunction renderSubjectComponent(subject, reSupport, ownerSupport) {\n const preClones = ownerSupport.clones.map(clone => clone);\n reSupport = renderWithSupport(reSupport, subject.tagSupport, // existing tag\n subject, ownerSupport);\n reSupport.global.newest = reSupport;\n // ??? - mirroring add 0\n // reSupport.ownerTagSupport = ownerSupport\n if (ownerSupport.clones.length > preClones.length) {\n const myClones = ownerSupport.clones.filter(fClone => !preClones.find(clone => clone === fClone));\n reSupport.clones.push(...myClones);\n }\n ownerSupport.childTags.push(reSupport);\n return reSupport;\n}\n","import { processSubjectComponent } from './processSubjectComponent.function';\nimport { isTagArray, isTagClass, isTagComponent, isTagTemplater } from './isInstance';\nimport { processTagArray } from './processTagArray';\nimport { processRegularValue } from './processRegularValue.function';\nimport { processTag, tagFakeTemplater } from './processTag.function';\nvar ValueTypes;\n(function (ValueTypes) {\n ValueTypes[\"tag\"] = \"tag\";\n ValueTypes[\"templater\"] = \"templater\";\n ValueTypes[\"tagArray\"] = \"tag-array\";\n ValueTypes[\"tagComponent\"] = \"tag-component\";\n ValueTypes[\"value\"] = \"value\";\n})(ValueTypes || (ValueTypes = {}));\nfunction getValueType(value) {\n if (isTagComponent(value)) {\n return ValueTypes.tagComponent;\n }\n if (isTagTemplater(value)) {\n return ValueTypes.templater;\n }\n if (isTagClass(value)) {\n return ValueTypes.tag;\n }\n if (isTagArray(value)) {\n return ValueTypes.tagArray;\n }\n return ValueTypes.value;\n}\n// export type ExistingValue = TemplaterResult | Tag[] | TagSupport | Function | Subject<unknown> | RegularValue | Tag\nexport function processSubjectValue(value, subject, // could be tag via result.tag\ninsertBefore, // <template end interpolate /> (will be removed)\nownerSupport, // owner\noptions) {\n const valueType = getValueType(value);\n switch (valueType) {\n case ValueTypes.templater:\n processTag(value, insertBefore, ownerSupport, subject);\n return;\n case ValueTypes.tag:\n const tag = value;\n let templater = tag.templater;\n if (!templater) {\n templater = tagFakeTemplater(tag);\n }\n processTag(templater, insertBefore, ownerSupport, subject);\n return;\n case ValueTypes.tagArray:\n return processTagArray(subject, value, insertBefore, ownerSupport, options);\n case ValueTypes.tagComponent:\n processSubjectComponent(value, subject, insertBefore, ownerSupport, options);\n return;\n }\n processRegularValue(value, subject, insertBefore);\n}\n","import { TagSupport } from './TagSupport.class';\nimport { ValueSubject } from './subject';\n/** Could be a regular tag or a component. Both are Tag.class */\nexport function processTag(templater, insertBefore, ownerSupport, // owner\nsubject) {\n let tagSupport = subject.tagSupport;\n // first time seeing this tag?\n if (!tagSupport) {\n tagSupport = new TagSupport(templater, ownerSupport, subject);\n setupNewTemplater(tagSupport, ownerSupport, subject);\n ownerSupport.childTags.push(tagSupport);\n }\n subject.tagSupport = tagSupport;\n tagSupport.ownerTagSupport = ownerSupport;\n tagSupport.buildBeforeElement(insertBefore, {\n counts: { added: 0, removed: 0 },\n forceElement: true,\n });\n}\nexport function setupNewTemplater(tagSupport, ownerSupport, subject) {\n tagSupport.global.oldest = tagSupport;\n tagSupport.global.newest = tagSupport;\n // asking me to render will cause my parent to render\n tagSupport.ownerTagSupport = ownerSupport;\n subject.tagSupport = tagSupport;\n}\nexport function tagFakeTemplater(tag) {\n const templater = getFakeTemplater();\n templater.tag = tag;\n tag.templater = templater;\n return templater;\n}\nexport function getFakeTemplater() {\n return {\n children: new ValueSubject([]), // no children\n props: {},\n isTag: true,\n isTemplater: false,\n tagged: false,\n // wrapper: (() => undefined) as unknown as Wrapper,\n };\n}\n","import { ValueSubject } from './subject/ValueSubject';\nimport { ArrayNoKeyError } from './errors';\nimport { destroyArrayTag } from './checkDestroyPrevious.function';\nimport { setupNewTemplater, tagFakeTemplater } from './processTag.function';\nimport { TagSupport } from './TagSupport.class';\nimport { isTagClass } from './isInstance';\nexport function processTagArray(subject, value, // arry of Tag classes\ninsertBefore, // <template end interpolate />\nownerSupport, options) {\n const clones = ownerSupport.clones; // []\n let lastArray = subject.lastArray = subject.lastArray || [];\n if (!subject.placeholder) {\n setPlaceholderElm(insertBefore, subject);\n }\n const runtimeInsertBefore = subject.placeholder; // || insertBefore\n let removed = 0;\n /** 🗑️ remove previous items first */\n lastArray = subject.lastArray = subject.lastArray.filter((item, index) => {\n const newLength = value.length - 1;\n const at = index - removed;\n const lessLength = newLength < at;\n const subValue = value[index - removed];\n const subTag = subValue;\n // const tag = subTag?.templater.tag as Tag\n const lastTag = item.tagSupport.templater.tag;\n const newArrayValue = subTag?.memory.arrayValue;\n const lastArrayValue = lastTag.memory.arrayValue;\n const destroyItem = lessLength || !areLikeValues(newArrayValue, lastArrayValue);\n if (destroyItem) {\n const last = lastArray[index];\n const tagSupport = last.tagSupport;\n destroyArrayTag(tagSupport, options.counts);\n last.deleted = true;\n ++removed;\n ++options.counts.removed;\n return false;\n }\n return true;\n });\n value.forEach((item, index) => {\n const previous = lastArray[index];\n const previousSupport = previous?.tagSupport;\n const subTag = item;\n if (isTagClass(subTag) && !subTag.templater) {\n tagFakeTemplater(subTag);\n }\n const tagSupport = new TagSupport(subTag.templater, ownerSupport, new ValueSubject(undefined));\n // tagSupport.templater = subTag.templater\n if (previousSupport) {\n setupNewTemplater(tagSupport, ownerSupport, previousSupport.subject);\n const global = previousSupport.global;\n tagSupport.global = global;\n global.newest = tagSupport;\n }\n // check for html``.key()\n const keySet = 'arrayValue' in subTag.memory;\n if (!keySet) {\n const details = {\n template: tagSupport.getTemplate().string,\n array: value,\n ownerTagContent: ownerSupport.lastTemplateString,\n };\n const message = 'Use html`...`.key(item) instead of html`...` to template an Array';\n console.error(message, details);\n const err = new ArrayNoKeyError(message, details);\n throw err;\n }\n const couldBeSame = lastArray.length > index;\n if (couldBeSame) {\n const prevSupport = previous.tagSupport;\n const prevGlobal = prevSupport.global;\n // subTag.tagSupport = subTag.tagSupport || prevSupport\n const oldest = prevGlobal.oldest;\n oldest.updateBy(tagSupport);\n return [];\n }\n processAddTagArrayItem(runtimeInsertBefore, tagSupport, index, options, lastArray);\n ownerSupport.childTags.push(tagSupport);\n });\n return clones;\n}\nfunction setPlaceholderElm(insertBefore, subject) {\n if (insertBefore.nodeName !== 'TEMPLATE') {\n subject.placeholder = insertBefore;\n return;\n }\n const placeholder = subject.placeholder = document.createTextNode('');\n const parentNode = insertBefore.parentNode;\n parentNode.insertBefore(placeholder, insertBefore);\n parentNode.removeChild(insertBefore);\n}\nfunction processAddTagArrayItem(before, tagSupport, index, options, lastArray) {\n const lastValue = {\n tagSupport, index\n };\n // Added to previous array\n lastArray.push(lastValue);\n const counts = {\n added: options.counts.added + index,\n removed: options.counts.removed,\n };\n const newTempElm = document.createElement('template');\n const parent = before.parentNode;\n parent.insertBefore(newTempElm, before);\n tagSupport.buildBeforeElement(newTempElm, // before,\n { counts, forceElement: options.forceElement });\n}\n/** compare two values. If both values are arrays then the items will be compared */\nfunction areLikeValues(valueA, valueB) {\n if (valueA === valueB) {\n return true;\n }\n const bothArrays = valueA instanceof Array && valueB instanceof Array;\n const matchLengths = bothArrays && valueA.length == valueB.length;\n if (matchLengths) {\n return valueA.every((item, index) => item == valueB[index]);\n }\n return false;\n}\n","export function processTagResult(tagSupport, subject, // used for recording past and current value\ninsertBefore, // <template end interpolate />\n{ counts, forceElement, }) {\n // *if appears we already have seen\n const subjectTag = subject;\n const lastSupport = subjectTag.tagSupport;\n const prevSupport = lastSupport?.global.oldest || undefined; // || tag.tagSupport.oldest // subjectTag.tag\n const justUpdate = prevSupport; // && !forceElement\n if (prevSupport && justUpdate) {\n return processTagResultUpdate(tagSupport, subjectTag, prevSupport);\n }\n tagSupport.buildBeforeElement(insertBefore, {\n counts,\n forceElement,\n });\n}\nfunction processTagResultUpdate(tagSupport, subject, // used for recording past and current value\nprevSupport) {\n // components\n if (subject instanceof Function) {\n const newSupport = subject(prevSupport);\n prevSupport.updateBy(newSupport);\n subject.tagSupport = newSupport;\n return;\n }\n prevSupport.updateBy(tagSupport);\n subject.tagSupport = tagSupport;\n return;\n}\n","export function buildClones(temporary, insertBefore) {\n const clones = [];\n const template = temporary.children[0];\n let nextSibling = template.content.firstChild;\n while (nextSibling) {\n const nextNextSibling = nextSibling.nextSibling;\n buildSibling(nextSibling, insertBefore);\n clones.push(nextSibling);\n nextSibling = nextNextSibling;\n }\n return clones;\n}\nfunction buildSibling(nextSibling, insertBefore) {\n const parentNode = insertBefore.parentNode;\n parentNode.insertBefore(nextSibling, insertBefore);\n}\n","import { providersChangeCheck } from './state/provider.utils';\nimport { renderWithSupport } from './TemplaterResult.class';\nimport { isLikeTags } from './isLikeTags.function';\n/** Returns true when rendering owner is not needed. Returns false when rendering owner should occur */\nexport function renderExistingTag(oldestSupport, // oldest with elements on html\nnewSupport, // new to be rendered\nownerSupport, // ownerSupport\nsubject) {\n const lastSupport = subject.tagSupport;\n const global = lastSupport.global;\n // share point between renders\n newSupport.global = global;\n const preRenderCount = global.renderCount;\n providersChangeCheck(oldestSupport);\n // When the providers were checked, a render to myself occurred and I do not need to re-render again\n const prevSupport = global.newest;\n if (preRenderCount !== global.renderCount) {\n oldestSupport.updateBy(prevSupport);\n return prevSupport; // already rendered during triggered events\n }\n // ??? changed during mirroring - lastSupport keeps having less info than newest\n // const toRedrawTag = lastSupport || prevSupport || tagSupport.global.oldest\n const toRedrawTag = prevSupport || lastSupport || global.oldest;\n const reSupport = renderWithSupport(newSupport, toRedrawTag, subject, \n // oldestSupport,\n ownerSupport);\n const oldest = global.oldest || oldestSupport;\n reSupport.global.oldest = oldest;\n if (isLikeTags(prevSupport, reSupport)) {\n subject.tagSupport = reSupport;\n oldest.updateBy(reSupport);\n }\n return reSupport;\n}\n","import { deepEqual } from './deepFunctions';\nimport { renderExistingTag } from './renderExistingTag.function';\n/** Main function used by all other callers to render/update display of a tag component */\nexport function renderTagSupport(tagSupport, renderUp) {\n const global = tagSupport.global;\n const templater = tagSupport.templater;\n // is it just a vanilla tag, not component?\n if (!templater.wrapper) { // || isTagTemplater(templater) \n const newTag = global.newest;\n const ownerTag = newTag.ownerTagSupport;\n ++global.renderCount;\n return renderTagSupport(ownerTag, true);\n }\n const subject = tagSupport.subject;\n const newest = global.newest;\n let ownerSupport;\n let selfPropChange = false;\n const shouldRenderUp = renderUp && newest;\n if (shouldRenderUp) {\n ownerSupport = newest.ownerTagSupport;\n if (ownerSupport) {\n const nowProps = templater.props;\n const latestProps = newest.propsConfig.latestCloned;\n selfPropChange = !deepEqual(nowProps, latestProps);\n }\n }\n // const useTagSupport = global.newest as TagSupport // oldTagSetup\n const oldest = tagSupport.global.oldest;\n const tag = renderExistingTag(oldest, tagSupport, ownerSupport, // useTagSupport,\n subject);\n const renderOwner = ownerSupport && selfPropChange;\n if (renderOwner) {\n const ownerTagSupport = ownerSupport;\n renderTagSupport(ownerTagSupport, true);\n return tag;\n }\n return tag;\n}\n","export function setTagPlaceholder(global) {\n const insertBefore = global.insertBefore;\n const placeholder = global.placeholder = document.createTextNode('');\n const parentNode = insertBefore.parentNode;\n parentNode.insertBefore(placeholder, insertBefore);\n parentNode.removeChild(insertBefore);\n}\n","import { setUse } from \"./setUse.function\";\nimport { getStateValue } from \"./state.utils\";\nimport { renderTagSupport } from \"../renderTagSupport.function\";\nimport { SyncCallbackError } from \"../errors\";\nlet innerCallback = (callback) => (a, b, c, d, e, f) => {\n throw new SyncCallbackError('Callback function was called immediately in sync and must instead be call async');\n};\nexport const callbackMaker = () => innerCallback;\nconst originalGetter = innerCallback; // callbackMaker\nsetUse({\n beforeRender: (tagSupport) => initMemory(tagSupport),\n beforeRedraw: (tagSupport) => initMemory(tagSupport),\n afterRender: (_tagSupport) => {\n innerCallback = originalGetter; // prevent crossing callbacks with another tag\n },\n});\nfunction updateState(stateFrom, stateTo) {\n stateFrom.forEach((state, index) => {\n const fromValue = getStateValue(state);\n const callback = stateTo[index].callback;\n if (callback) {\n callback(fromValue); // set the value\n }\n stateTo[index].lastValue = fromValue; // record the value\n });\n}\nfunction initMemory(tagSupport) {\n const oldState = setUse.memory.stateConfig.array;\n innerCallback = (callback) => {\n const trigger = (...args) => triggerStateUpdate(tagSupport, callback, oldState, ...args);\n return trigger;\n };\n}\nfunction triggerStateUpdate(tagSupport, callback, oldState, ...args) {\n const state = tagSupport.memory.state;\n // ensure that the oldest has the latest values first\n updateState(state, oldState);\n // run the callback\n const promise = callback(...args);\n // send the oldest state changes into the newest\n updateState(oldState, state);\n renderTagSupport(tagSupport, false);\n if (promise instanceof Promise) {\n promise.finally(() => {\n // send the oldest state changes into the newest\n updateState(oldState, state);\n renderTagSupport(tagSupport, false);\n });\n }\n}\n","export * from \"./watch.function\";\nexport { setUse } from \"./setUse.function\";\nexport { state } from \"./state.function\";\nexport { letState } from \"./letState.function\";\nexport { setProp } from \"./setProp.function\";\nexport { providers } from \"./providers\";\nexport * from \"./callbackMaker.function\";\nexport * from \"./onInit\";\nexport * from \"./onDestroy\";\n","import { getStateValue } from './state.utils';\nimport { setUse } from './setUse.function';\n/** Used for variables that need to remain the same variable during render passes */\nexport function letState(defaultValue) {\n const config = setUse.memory.stateConfig;\n const rearray = config.rearray;\n let getSetMethod;\n const restate = rearray[config.array.length];\n if (restate) {\n let oldValue = getStateValue(restate);\n getSetMethod = ((x) => [oldValue, oldValue = x]);\n const push = {\n get: () => getStateValue(push),\n callback: getSetMethod,\n lastValue: oldValue,\n defaultValue: restate.defaultValue,\n };\n config.array.push(push);\n return makeStateResult(oldValue, push);\n }\n // State first time run\n const defaultFn = defaultValue instanceof Function ? defaultValue : () => defaultValue;\n let initValue = defaultFn();\n getSetMethod = ((x) => [initValue, initValue = x]);\n const push = {\n get: () => getStateValue(push),\n callback: getSetMethod,\n lastValue: initValue,\n defaultValue: initValue,\n };\n config.array.push(push);\n return makeStateResult(initValue, push);\n}\nfunction makeStateResult(initValue, push) {\n // return initValue\n const result = (y) => {\n push.callback = y || (x => [initValue, initValue = x]);\n return initValue;\n };\n return result;\n}\n","import { setUse } from \"./setUse.function\";\n/** When undefined, it means a tag is being built for the first time so do run destroy(s) */\nlet destroyCurrentTagSupport;\nexport function onDestroy(callback) {\n destroyCurrentTagSupport.global.destroyCallback = callback;\n}\nsetUse({\n beforeRender: tagSupport => destroyCurrentTagSupport = tagSupport,\n beforeRedraw: tagSupport => destroyCurrentTagSupport = tagSupport,\n beforeDestroy: (tagSupport, tag) => {\n const callback = tagSupport.global.destroyCallback;\n if (callback) {\n callback();\n }\n }\n});\n","import { setUse } from \"./setUse.function\";\nfunction setCurrentTagSupport(support) {\n setUse.memory.initCurrentSupport = support;\n}\nexport function onInit(callback) {\n const tagSupport = setUse.memory.initCurrentSupport;\n if (!tagSupport.global.init) {\n tagSupport.global.init = callback;\n callback(); // fire init\n }\n}\nsetUse({\n beforeRender: tagSupport => setCurrentTagSupport(tagSupport),\n beforeRedraw: tagSupport => setCurrentTagSupport(tagSupport),\n});\n","import { deepClone, deepEqual } from '../deepFunctions';\nimport { renderTagSupport } from '../renderTagSupport.function';\nexport function providersChangeCheck(tagSupport) {\n const global = tagSupport.global;\n const providersWithChanges = global.providers.filter(provider => !deepEqual(provider.instance, provider.clone));\n // reset clones\n providersWithChanges.forEach(provider => {\n const appElement = tagSupport.getAppElement();\n handleProviderChanges(appElement, provider);\n provider.clone = deepClone(provider.instance);\n });\n}\nfunction handleProviderChanges(appElement, provider) {\n const tagsWithProvider = getTagsWithProvider(appElement, provider);\n tagsWithProvider.forEach(({ tagSupport, renderCount, provider }) => {\n if (tagSupport.global.deleted) {\n return; // i was deleted after another tag processed\n }\n const notRendered = renderCount === tagSupport.global.renderCount;\n if (notRendered) {\n provider.clone = deepClone(provider.instance);\n renderTagSupport(tagSupport, false);\n }\n });\n}\nfunction getTagsWithProvider(tagSupport, provider, memory = []) {\n const global = tagSupport.global;\n const compare = global.providers;\n const hasProvider = compare.find(xProvider => xProvider.constructMethod === provider.constructMethod);\n if (hasProvider) {\n memory.push({\n tagSupport,\n renderCount: global.renderCount,\n provider: hasProvider,\n });\n }\n tagSupport.childTags.forEach(child => getTagsWithProvider(child, provider, memory));\n return memory;\n}\n","import { deepClone } from '../deepFunctions';\nimport { setUse } from './setUse.function';\nsetUse.memory.providerConfig = {\n providers: [],\n ownerSupport: undefined,\n};\nfunction get(constructMethod) {\n const config = setUse.memory.providerConfig;\n const providers = config.providers;\n return providers.find(provider => provider.constructMethod === constructMethod);\n}\nexport const providers = {\n create: (constructMethod) => {\n const existing = get(constructMethod);\n if (existing) {\n existing.clone = deepClone(existing.instance);\n return existing.instance;\n }\n // Providers with provider requirements just need to use providers.create() and providers.inject()\n const instance = 'prototype' in constructMethod ? new constructMethod() : constructMethod();\n const config = setUse.memory.providerConfig;\n config.providers.push({\n constructMethod,\n instance,\n clone: deepClone(instance)\n });\n return instance;\n },\n /**\n * @template T\n * @param {(new (...args: any[]) => T) | () => T} constructor\n * @returns {T}\n */\n inject: (constructor) => {\n const oldValue = get(constructor);\n if (oldValue) {\n return oldValue.instance;\n }\n const config = setUse.memory.providerConfig;\n let owner = {\n ownerTagSupport: config.ownerSupport\n };\n while (owner.ownerTagSupport) {\n const ownerProviders = owner.ownerTagSupport.global.providers;\n const provider = ownerProviders.find(provider => {\n if (provider.constructMethod === constructor) {\n return true;\n }\n });\n if (provider) {\n provider.clone = deepClone(provider.instance); // keep a copy of the latest before any change occur\n config.providers.push(provider);\n return provider.instance;\n }\n owner = owner.ownerTagSupport; // cause reloop\n }\n const msg = `Could not inject provider: ${constructor.name} ${constructor}`;\n console.warn(`${msg}. Available providers`, config.providers);\n throw new Error(msg);\n }\n};\nsetUse({\n beforeRender: (tagSupport, ownerSupport) => {\n run(tagSupport, ownerSupport);\n },\n beforeRedraw: (tagSupport, newTagSupport) => {\n run(tagSupport, newTagSupport.ownerTagSupport);\n },\n afterRender: (tagSupport) => {\n const config = setUse.memory.providerConfig;\n tagSupport.global.providers = [...config.providers];\n config.providers.length = 0;\n }\n});\nfunction run(tagSupport, ownerSupport) {\n const config = setUse.memory.providerConfig;\n config.ownerSupport = ownerSupport;\n if (tagSupport.global.providers.length) {\n config.providers.length = 0;\n config.providers.push(...tagSupport.global.providers);\n }\n}\n","import { getStateValue } from './state.utils';\nimport { setUse } from './setUse.function';\n/** Used for variables that need to remain the same variable during render passes */\nexport function setProp(getSet) {\n const config = setUse.memory.stateConfig;\n const rearray = config.rearray;\n const [propValue] = getSet(undefined);\n getSet(propValue); // restore original value instead of undefined\n const restate = rearray[config.array.length];\n if (restate) {\n let watchValue = restate.watch;\n let oldValue = getStateValue(restate);\n const push = {\n get: () => getStateValue(push),\n callback: getSet,\n lastValue: oldValue,\n watch: restate.watch,\n };\n // has the prop value changed?\n if (propValue != watchValue) {\n push.watch = propValue;\n oldValue = push.lastValue = propValue;\n }\n config.array.push(push);\n getSet(oldValue);\n return oldValue;\n }\n const push = {\n get: () => getStateValue(push),\n callback: getSet,\n lastValue: propValue,\n watch: propValue,\n };\n config.array.push(push);\n return propValue;\n}\n","const tagUse = [];\nexport function setUse(use) {\n // must provide defaults\n const useMe = {\n beforeRender: use.beforeRender || (() => undefined),\n beforeRedraw: use.beforeRedraw || (() => undefined),\n afterRender: use.afterRender || (() => undefined),\n beforeDestroy: use.beforeDestroy || (() => undefined),\n };\n setUse.tagUse.push(useMe);\n}\nsetUse.tagUse = tagUse;\nsetUse.memory = {};\n","import { setUse } from './setUse.function';\nimport { getStateValue } from './state.utils';\n/** Used for variables that need to remain the same variable during render passes */\nexport function state(defaultValue) {\n const config = setUse.memory.stateConfig;\n let getSetMethod;\n const rearray = config.rearray;\n const restate = rearray[config.array.length];\n if (restate) {\n let oldValue = getStateValue(restate);\n getSetMethod = ((x) => [oldValue, oldValue = x]);\n const push = {\n get: () => getStateValue(push),\n callback: getSetMethod,\n lastValue: oldValue,\n defaultValue: restate.defaultValue,\n };\n config.array.push(push);\n return oldValue;\n }\n // State first time run\n const defaultFn = defaultValue instanceof Function ? defaultValue : () => defaultValue;\n let initValue = defaultFn();\n getSetMethod = ((x) => [initValue, initValue = x]);\n const push = {\n get: () => getStateValue(push),\n callback: getSetMethod,\n lastValue: initValue,\n defaultValue: initValue,\n };\n config.array.push(push);\n return initValue;\n}\n","import { StateMismatchError } from '../errors';\nimport { setUse } from './setUse.function';\n// TODO: rename\nsetUse.memory.stateConfig = {\n array: [], // state memory on the first render\n // rearray: [] as StateConfigArray, // state memory to be used before the next render\n};\nconst beforeRender = (tagSupport) => initState(tagSupport);\nsetUse({\n beforeRender,\n beforeRedraw: beforeRender,\n afterRender: (tagSupport) => {\n const memory = tagSupport.memory;\n const state = memory.state;\n const config = setUse.memory.stateConfig;\n const rearray = config.rearray;\n if (rearray.length) {\n if (rearray.length !== config.array.length) {\n const message = `States lengths has changed ${rearray.length} !== ${config.array.length}. Typically occurs when a function is intended to be wrapped with a tag() call`;\n const wrapper = tagSupport.templater?.wrapper;\n const details = {\n oldStates: config.array,\n newStates: config.rearray,\n tagFunction: wrapper.original,\n };\n const error = new StateMismatchError(message, details);\n console.warn(message, details);\n throw error;\n }\n }\n delete config.rearray; // clean up any previous runs\n memory.state = config.array; // [...config.array]\n memory.state.forEach(item => item.lastValue = getStateValue(item)); // set last values\n config.array = [];\n }\n});\nexport function getStateValue(\n// state: StateConfig,\nstate) {\n const callback = state.callback;\n if (!callback) {\n return state.defaultValue;\n }\n const oldState = callback(StateEchoBack); // get value and set to undefined\n const [oldValue] = oldState;\n const [checkValue] = callback(oldValue); // set back to original value\n if (checkValue !== StateEchoBack) {\n const message = 'State property not used correctly. Second item in array is not setting value as expected.\\n\\n' +\n 'For \"let\" state use `let name = state(default)(x => [name, name = x])`\\n\\n' +\n 'For \"const\" state use `const name = state(default)()`\\n\\n' +\n 'Problem state:\\n' + (callback ? callback.toString() : JSON.stringify(state)) + '\\n';\n console.error(message, { state, callback, oldState, oldValue, checkValue });\n throw new Error(message);\n }\n // state.lastValue = oldValue\n return oldValue;\n}\nexport class StateEchoBack {\n}\nfunction initState(tagSupport) {\n const memory = tagSupport.memory;\n const state = memory.state;\n const config = setUse.memory.stateConfig;\n // TODO: This guard may no longer be needed\n if (config.rearray) {\n const wrapper = tagSupport.templater?.wrapper;\n const wasWrapper = config.tagSupport?.templater.wrapper;\n const message = 'last state not cleared. Possibly in the middle of rendering one component and another is trying to render';\n console.error(message, {\n config,\n tagFunction: wrapper.original,\n wasInMiddleOf: wasWrapper.original,\n state,\n expectedClearArray: config.rearray,\n });\n throw new StateMismatchError(message, {\n config,\n tagFunction: wrapper.original,\n state,\n expectedClearArray: config.rearray,\n });\n }\n // TODO: this maybe redundant and not needed\n config.rearray = []; // .length = 0\n if (state?.length) {\n state.forEach(state => getStateValue(state));\n config.rearray.push(...state);\n }\n config.tagSupport = tagSupport;\n}\n","import { letState } from './letState.function';\n/**\n * When an item in watch array changes, callback function will be triggered. Does not trigger on initial watch setup.\n * @param currentValues T[]\n * @param callback WatchCallback\n * @returns T[]\n */\nexport function watch(currentValues, callback) {\n let previousValues = letState(undefined)(x => [previousValues, previousValues = x]);\n // First time running watch?\n if (previousValues === undefined) {\n // callback(currentValues, previousValues) // do not call during init\n previousValues = currentValues;\n return currentValues;\n }\n const allExact = currentValues.every((item, index) => item === previousValues[index]);\n if (allExact) {\n return currentValues;\n }\n callback(currentValues, previousValues);\n previousValues.length = 0;\n previousValues.push(...currentValues);\n return currentValues;\n}\n","export class Subject {\n value;\n onSubscription;\n methods = [];\n isSubject = true;\n subscribers = [];\n subscribeWith;\n // unsubcount = 0 // 🔬 testing\n constructor(value, onSubscription) {\n this.value = value;\n this.onSubscription = onSubscription;\n }\n subscribe(callback) {\n const subscription = getSubscription(this, callback);\n // are we within a pipe?\n const subscribeWith = this.subscribeWith;\n if (subscribeWith) {\n // are we in a pipe?\n if (this.methods.length) {\n const orgCallback = callback;\n callback = (value) => {\n runPipedMethods(value, this.methods, lastValue => orgCallback(lastValue, subscription));\n };\n }\n return subscribeWith(callback);\n }\n this.subscribers.push(subscription);\n SubjectClass.globalSubs.push(subscription); // 🔬 testing\n if (this.onSubscription) {\n this.onSubscription(subscription);\n }\n return subscription;\n }\n set(value) {\n this.value = value;\n // Notify all subscribers with the new value\n this.subscribers.forEach(sub => {\n // (sub.callback as any).value = value\n sub.callback(value, sub);\n });\n }\n next = this.set;\n toPromise() {\n return new Promise((res, rej) => {\n this.subscribe((x, subscription) => {\n subscription.unsubscribe();\n res(x);\n });\n });\n }\n // like toPromise but faster\n toCallback(callback) {\n this.subscribe((x, subscription) => {\n subscription.unsubscribe();\n callback(x);\n });\n }\n pipe(...operations) {\n const subject = new Subject();\n subject.methods = operations;\n subject.subscribeWith = (x) => this.subscribe(x);\n return subject;\n }\n}\nfunction removeSubFromArray(subscribers, callback) {\n const index = subscribers.findIndex(sub => sub.callback === callback);\n if (index !== -1) {\n subscribers.splice(index, 1);\n }\n}\nconst SubjectClass = Subject;\nSubjectClass.globalSubs = []; // 🔬 for testing\nSubjectClass.globalSubCount$ = new Subject(); // for ease of debugging\nSubjectClass.globalSubCount$.set(0);\nfunction getSubscription(subject, callback) {\n const countSubject = SubjectClass.globalSubCount$;\n SubjectClass.globalSubCount$.set(countSubject.value + 1);\n const subscription = () => {\n subscription.unsubscribe();\n };\n subscription.callback = callback;\n subscription.subscriptions = [];\n // Return a function to unsubscribe from the BehaviorSubject\n subscription.unsubscribe = () => {\n removeSubFromArray(subject.subscribers, callback); // each will be called when update comes in\n removeSubFromArray(SubjectClass.globalSubs, callback); // 🔬 testing\n SubjectClass.globalSubCount$.set(countSubject.value - 1);\n // any double unsubscribes will be ignored\n subscription.unsubscribe = () => subscription;\n // unsubscribe from any combined subjects\n subscription.subscriptions.forEach(subscription => subscription.unsubscribe());\n return subscription;\n };\n subscription.add = (sub) => {\n subscription.subscriptions.push(sub);\n return subscription;\n };\n subscription.next = (value) => {\n callback(value, subscription);\n };\n return subscription;\n}\nfunction runPipedMethods(value, methods, onComplete) {\n const cloneMethods = [...methods];\n const firstMethod = cloneMethods.shift();\n const next = (newValue) => {\n if (cloneMethods.length) {\n return runPipedMethods(newValue, cloneMethods, onComplete);\n }\n onComplete(newValue);\n // return newValue = next\n };\n let handler = next;\n const setHandler = (x) => handler = x;\n const pipeUtils = { setHandler, next };\n const methodResponse = firstMethod(value, pipeUtils);\n handler(methodResponse);\n}\n","import { Subject } from './Subject.class';\nexport class ValueSubject extends Subject {\n value;\n constructor(value) {\n super(value);\n this.value = value;\n }\n subscribe(callback) {\n const subscription = super.subscribe(callback);\n // Call the callback immediately with the current value\n callback(this.value, subscription);\n return subscription;\n }\n}\n","import { Subject } from \"./Subject.class\";\nexport function combineLatest(subjects) {\n const output = new Subject();\n const subscribe = (callback) => {\n const valuesSeen = [];\n const values = [];\n const setValue = (x, index) => {\n valuesSeen[index] = true;\n values[index] = x;\n if (valuesSeen.length === subjects.length && valuesSeen.every(x => x)) {\n callback(values, subscription);\n }\n };\n const clones = [...subjects];\n const firstSub = clones.shift();\n const subscription = firstSub.subscribe(x => setValue(x, 0));\n const subscriptions = clones.map((subject, index) => subject.subscribe(x => setValue(x, index + 1)));\n subscription.subscriptions = subscriptions;\n return subscription;\n };\n output.subscribeWith = subscribe;\n return output;\n}\n","export * from './Subject.class';\nexport * from './ValueSubject';\nexport * from './combineLatest.function';\nexport * from './will.functions';\n","export function willCallback(callback) {\n return ((lastValue, utils) => {\n utils.setHandler(() => {\n return undefined;\n });\n callback(lastValue, utils.next);\n });\n}\n/** .pipe( promise((x) => Promise.resolve(44)) ) */\nexport function willPromise(callback) {\n return ((lastValue, utils) => {\n utils.setHandler(() => {\n return undefined;\n }); // do nothing on initial return\n const result = callback(lastValue);\n result.then(x => utils.next(x));\n });\n}\n/** .pipe( willSubscribe((x) => new ValueSubject(44)) ) */\nexport const willSubscribe = (callback) => {\n return ((lastValue, utils) => {\n utils.setHandler(() => {\n return undefined;\n }); // do nothing on initial return\n const result = callback(lastValue);\n const subscription = result.subscribe(x => {\n subscription.unsubscribe();\n utils.next(x);\n });\n });\n};\n","import { isSubjectInstance, isTagArray, isTagClass, isTagTemplater } from './isInstance';\nimport { setUse } from './state';\nimport { TemplaterResult } from './TemplaterResult.class';\nimport { runTagCallback } from './interpolations/bindSubjectCallback.function';\nimport { deepClone } from './deepFunctions';\nimport { TagSupport } from './TagSupport.class';\nimport { alterProps } from './alterProps.function';\nimport { ValueSubject } from './subject/ValueSubject';\nexport const tags = [];\nlet tagCount = 0;\n/** Wraps a tag component in a state manager and always push children to last argument as an array */\n// export function tag<T>(a: T): T;\nexport function tag(tagComponent) {\n /** function developer triggers */\n const result = (function tagWrapper(props, children) {\n // is the props argument actually children?\n const isPropTag = isTagClass(props) || isTagTemplater(props) || isTagArray(props);\n if (isPropTag) {\n children = props;\n props = undefined;\n }\n const { childSubject, madeSubject } = kidsToTagArraySubject(children);\n childSubject.isChildSubject = true;\n const templater = new TemplaterResult(props, childSubject);\n // attach memory back to original function that contains developer display logic\n const innerTagWrap = getTagWrap(templater, madeSubject);\n innerTagWrap.original = tagComponent;\n templater.tagged = true;\n templater.wrapper = innerTagWrap;\n return templater;\n }); // we override the function provided and pretend original is what's returned\n updateResult(result, tagComponent);\n // group tags together and have hmr pickup\n updateComponent(tagComponent);\n tags.push(tagComponent);\n // fake the return as being (props?, children?) => TemplaterResult\n return result;\n}\nfunction kidsToTagArraySubject(children) {\n if (isSubjectInstance(children)) {\n return { childSubject: children, madeSubject: false };\n }\n const kidArray = children;\n if (isTagArray(kidArray)) {\n return { childSubject: new ValueSubject(children), madeSubject: true };\n }\n const kid = children;\n if (kid) {\n kid.memory.arrayValue = 0;\n return { childSubject: new ValueSubject([kid]), madeSubject: true };\n }\n return {\n childSubject: new ValueSubject([]),\n madeSubject: true\n };\n}\nfunction updateResult(result, tagComponent) {\n result.isTag = true;\n result.original = tagComponent;\n}\nfunction updateComponent(tagComponent) {\n tagComponent.tags = tags;\n tagComponent.setUse = setUse;\n tagComponent.tagIndex = tagCount++; // needed for things like HMR\n}\n/** creates/returns a function that when called then calls the original component function\n * Gets used as templater.wrapper()\n */\nfunction getTagWrap(templater, madeSubject) {\n // this function gets called by taggedjs\n const innerTagWrap = function (oldTagSetup, subject) {\n const global = oldTagSetup.global;\n ++global.renderCount;\n const childSubject = templater.children;\n const lastArray = global.oldest?.templater.children.lastArray;\n if (lastArray) {\n childSubject.lastArray = lastArray;\n }\n const originalFunction = innerTagWrap.original;\n let props = templater.props;\n let castedProps = alterProps(props, oldTagSetup.ownerTagSupport);\n const clonedProps = deepClone(props); // castedProps\n // CALL ORIGINAL COMPONENT FUNCTION\n const tag = originalFunction(castedProps, childSubject);\n tag.templater = templater;\n templater.tag = tag;\n const tagSupport = new TagSupport(templater, oldTagSetup.ownerTagSupport, subject, global.renderCount);\n tagSupport.global = global;\n tagSupport.propsConfig = {\n latest: props,\n latestCloned: clonedProps,\n lastClonedKidValues: tagSupport.propsConfig.lastClonedKidValues,\n };\n tagSupport.memory = oldTagSetup.memory; // state handover\n if (madeSubject) {\n childSubject.value.forEach(kid => {\n kid.values.forEach((value, index) => {\n if (!(value instanceof Function)) {\n return;\n }\n const valuesValue = kid.values[index];\n if (valuesValue.isChildOverride) {\n return; // already overwritten\n }\n // all functions need to report to me\n kid.values[index] = function (...args) {\n const ownerSupport = tagSupport.ownerTagSupport;\n runTagCallback(value, // callback\n ownerSupport, this, // bindTo\n args);\n };\n valuesValue.isChildOverride = true;\n });\n });\n }\n return tagSupport;\n };\n return innerTagWrap;\n}\n","import { BaseTagSupport } from './TagSupport.class';\nimport { runAfterRender, runBeforeRender } from './tagRunner';\nimport { ValueSubject } from './subject/ValueSubject';\nconst appElements = [];\nexport function tagElement(app, // (...args: unknown[]) => TemplaterResult,\nelement, props) {\n const appElmIndex = appElements.findIndex(appElm => appElm.element === element);\n if (appElmIndex >= 0) {\n appElements[appElmIndex].tagSupport.destroy();\n appElements.splice(appElmIndex, 1);\n // an element already had an app on it\n console.warn('Found and destroyed app element already rendered to element', { element });\n }\n // Create the app which returns [props, runOneTimeFunction]\n const wrapper = app(props);\n // have a function setup and call the tagWrapper with (props, {update, async, on})\n const tagSupport = runWrapper(wrapper);\n // TODO: is the below needed?\n tagSupport.appElement = element;\n tagSupport.isApp = true;\n tagSupport.global.isApp = true;\n const templateElm = document.createElement('template');\n templateElm.setAttribute('id', 'app-tag-' + appElements.length);\n templateElm.setAttribute('app-tag-detail', appElements.length.toString());\n element.appendChild(templateElm);\n tagSupport.buildBeforeElement(templateElm);\n tagSupport.global.oldest = tagSupport;\n tagSupport.global.newest = tagSupport;\n element.setUse = app.original.setUse;\n appElements.push({ element, tagSupport });\n return {\n tagSupport,\n tags: app.original.tags,\n };\n}\nexport function runWrapper(templater) {\n let newSupport = {};\n const subject = new ValueSubject(newSupport);\n newSupport = new BaseTagSupport(templater, subject);\n subject.set(templater);\n subject.tagSupport = newSupport;\n runBeforeRender(newSupport, undefined);\n // Call the apps function for our tag templater\n const wrapper = templater.wrapper;\n const tagSupport = wrapper(newSupport, subject);\n runAfterRender(newSupport, tagSupport);\n return tagSupport;\n}\n","// TODO: This should be more like `new TaggedJs().use({})`\nimport { setUse } from './state';\nimport { Subject } from './subject';\n// Emits event at the end of a tag being rendered. Use tagClosed$.toPromise() to render a tag after a current tag is done rendering\nexport const tagClosed$ = new Subject(undefined, subscription => {\n if (!setUse.memory.stateConfig.rearray) {\n subscription.next(); // we are not currently processing so process now\n }\n});\n// Life cycle 1\nexport function runBeforeRender(tagSupport, ownerSupport) {\n setUse.tagUse.forEach(tagUse => tagUse.beforeRender(tagSupport, ownerSupport));\n}\n// Life cycle 2\nexport function runAfterRender(tagSupport, ownerTagSupport) {\n setUse.tagUse.forEach(tagUse => tagUse.afterRender(tagSupport, ownerTagSupport));\n tagClosed$.next(ownerTagSupport);\n}\n// Life cycle 3\nexport function runBeforeRedraw(tagSupport, ownerTagSupport) {\n setUse.tagUse.forEach(tagUse => tagUse.beforeRedraw(tagSupport, ownerTagSupport));\n}\n// Life cycle 4 - end of life\nexport function runBeforeDestroy(tagSupport, ownerTagSupport) {\n setUse.tagUse.forEach(tagUse => tagUse.beforeDestroy(tagSupport, ownerTagSupport));\n}\n","// Function to update the value of x\nexport function updateBeforeTemplate(value, lastFirstChild) {\n const parent = lastFirstChild.parentNode;\n let castedValue = value;\n // mimic React skipping to display EXCEPT for true does display on page\n if ([undefined, false, null].includes(value)) { // || value === true\n castedValue = '';\n }\n // Insert the new value (never use innerHTML here)\n const textNode = document.createTextNode(castedValue); // never innerHTML\n parent.insertBefore(textNode, lastFirstChild);\n /* remove existing nodes */\n parent.removeChild(lastFirstChild);\n return textNode;\n}\n","import { isSubjectInstance, isTagComponent } from './isInstance';\nimport { TagSupport } from './TagSupport.class';\nexport function updateContextItem(context, variableName, value) {\n const subject = context[variableName];\n const tagSubject = subject;\n const tagSupport = tagSubject.tagSupport;\n if (tagSupport) {\n if (value) {\n if (isTagComponent(value)) {\n const templater = value;\n let newSupport = new TagSupport(templater, tagSupport.ownerTagSupport, subject);\n if (isTagComponent(tagSupport)) {\n shareTemplaterGlobal(tagSupport, newSupport);\n }\n }\n }\n }\n if (isSubjectInstance(value)) {\n return;\n }\n // listeners will evaluate updated values to possibly update display(s)\n subject.set(value);\n return;\n}\nfunction shareTemplaterGlobal(oldTagSupport, tagSupport) {\n const oldTemp = oldTagSupport.templater;\n const oldWrap = oldTemp.wrapper; // tag versus component\n const oldValueFn = oldWrap.original;\n const templater = tagSupport.templater;\n const newWrapper = templater.wrapper;\n const newValueFn = newWrapper?.original;\n const fnMatched = oldValueFn === newValueFn;\n if (fnMatched) {\n tagSupport.global = oldTagSupport.global;\n // ??? new mirroring transfer state\n const newest = oldTagSupport.global.newest;\n if (newest) {\n const prevState = newest.memory.state;\n tagSupport.memory.state = [...prevState];\n }\n }\n}\n","import { hasTagSupportChanged } from './hasTagSupportChanged.function';\nimport { processSubjectComponent } from './processSubjectComponent.function';\nimport { destroyTagMemory } from './destroyTag.function';\nimport { renderTagSupport } from './renderTagSupport.function';\nimport { callbackPropOwner } from './alterProps.function';\nimport { isLikeTags } from './isLikeTags.function';\nexport function updateExistingTagComponent(ownerSupport, tagSupport, // lastest\nsubject, insertBefore) {\n // ??? changed during mirroring\n // let lastSupport = subject.tagSupport\n let lastSupport = subject.tagSupport?.global.newest; // || subject.tagSupport\n let oldestTag = lastSupport.global.oldest;\n const oldWrapper = lastSupport.templater.wrapper;\n const newWrapper = tagSupport.templater.wrapper;\n let isSameTag = false;\n if (oldWrapper && newWrapper) {\n const oldFunction = oldWrapper.original;\n const newFunction = newWrapper.original;\n isSameTag = oldFunction === newFunction;\n }\n const templater = tagSupport.templater;\n if (!isSameTag) {\n const oldestSupport = lastSupport.global.oldest;\n destroyTagMemory(oldestSupport, subject);\n return processSubjectComponent(templater, subject, insertBefore, ownerSupport, {\n forceElement: false,\n counts: { added: 0, removed: 0 },\n });\n }\n else {\n const hasChanged = hasTagSupportChanged(lastSupport, tagSupport, templater);\n if (!hasChanged) {\n // if the new props are an object then implicitly since no change, the old props are an object\n const newProps = templater.props;\n if (newProps && typeof (newProps) === 'object') {\n syncFunctionProps(lastSupport, ownerSupport, newProps);\n }\n return lastSupport; // its the same tag component\n }\n }\n const previous = lastSupport.global.newest;\n const newSupport = renderTagSupport(tagSupport, false);\n lastSupport = subject.tagSupport;\n const newOldest = newSupport.global.oldest;\n const hasOldest = newOldest ? true : false;\n if (!hasOldest) {\n return buildNewTag(newSupport, insertBefore, lastSupport, subject);\n }\n if (newOldest && templater.children.value.length) {\n const oldKidsSub = newOldest.templater.children;\n oldKidsSub.set(templater.children.value);\n }\n // detect if both the function is the same and the return is the same\n const isLikeTag = isSameTag && isLikeTags(previous, newSupport);\n if (isLikeTag) {\n subject.tagSupport = newSupport;\n oldestTag.updateBy(newSupport); // the oldest tag has element references\n return newSupport;\n }\n else {\n // Although function looked the same it returned a different html result\n if (isSameTag && lastSupport) {\n destroyTagMemory(lastSupport, subject);\n newSupport.global.context = {}; // do not share previous outputs\n }\n oldestTag = undefined;\n }\n if (!oldestTag) {\n lastSupport = newSupport;\n buildNewTag(newSupport, lastSupport.global.insertBefore, lastSupport, subject);\n }\n lastSupport.global.newest = newSupport;\n return newSupport;\n}\nfunction buildNewTag(newSupport, oldInsertBefore, oldTagSupport, subject) {\n newSupport.buildBeforeElement(oldInsertBefore, {\n forceElement: true,\n counts: { added: 0, removed: 0 },\n });\n newSupport.global.oldest = newSupport;\n newSupport.global.newest = newSupport;\n oldTagSupport.global.oldest = newSupport;\n oldTagSupport.global.newest = newSupport;\n subject.tagSupport = newSupport;\n return newSupport;\n}\nfunction syncFunctionProps(lastSupport, ownerSupport, newProps) {\n lastSupport = lastSupport.global.newest || lastSupport;\n const priorPropConfig = lastSupport.propsConfig;\n const priorProps = priorPropConfig.latestCloned;\n const prevSupport = ownerSupport.global.newest;\n Object.entries(priorProps).forEach(([name, value]) => {\n if (!(value instanceof Function)) {\n return;\n }\n // TODO: The code below maybe irrelevant\n const newCallback = newProps[name];\n const original = newCallback.original;\n if (original) {\n return; // already previously converted\n }\n // Currently, call self but over parent state changes, I may need to call a newer parent tag owner\n priorProps[name].toCall = (...args) => {\n return callbackPropOwner(newCallback, // value, // newOriginal,\n args, prevSupport);\n };\n return;\n });\n}\n","import { TagSupport } from './TagSupport.class';\nimport { TemplaterResult } from './TemplaterResult.class';\nimport { isSubjectInstance, isTagArray, isTagClass, isTagComponent, isTagTemplater } from './isInstance';\nimport { processTagArray } from './processTagArray';\nimport { updateExistingTagComponent } from './updateExistingTagComponent.function';\nimport { processRegularValue } from './processRegularValue.function';\nimport { checkDestroyPrevious } from './checkDestroyPrevious.function';\nimport { ValueSubject } from './subject/ValueSubject';\nimport { processSubjectComponent } from './processSubjectComponent.function';\nimport { isLikeTags } from './isLikeTags.function';\nimport { bindSubjectCallback } from './interpolations/bindSubjectCallback.function';\nimport { setupNewTemplater, getFakeTemplater, processTag } from './processTag.function';\nimport { insertAfter } from './insertAfter.function';\nexport function updateExistingValue(subject, value, ownerSupport, insertBefore) {\n const subjectTag = subject;\n const isComponent = isTagComponent(value);\n checkDestroyPrevious(subject, value, insertBefore);\n // handle already seen tag components\n if (isComponent) {\n return prepareUpdateToComponent(value, subjectTag, insertBefore, ownerSupport);\n }\n // was component but no longer\n const tagSupport = subjectTag.tagSupport;\n if (tagSupport) {\n handleStillTag(subject, value, ownerSupport);\n return subjectTag;\n }\n // its another tag array\n if (isTagArray(value)) {\n processTagArray(subject, value, insertBefore, // oldInsertBefore as InsertBefore,\n ownerSupport, { counts: {\n added: 0,\n removed: 0,\n } });\n return subject;\n }\n if (isTagTemplater(value)) {\n processTag(value, insertBefore, ownerSupport, subjectTag);\n return subjectTag;\n }\n if (isTagClass(value)) {\n const tag = value;\n let templater = tag.templater;\n if (!templater) {\n templater = getFakeTemplater();\n tag.templater = templater;\n templater.tag = tag;\n }\n processTag(templater, insertBefore, ownerSupport, subjectTag);\n return subjectTag;\n }\n // we have been given a subject\n if (isSubjectInstance(value)) {\n return value;\n }\n // now its a function\n if (value instanceof Function) {\n const bound = bindSubjectCallback(value, ownerSupport);\n subject.set(bound);\n return subject;\n }\n // This will cause all other values to render\n processRegularValue(value, subject, insertBefore);\n return subjectTag;\n}\nfunction handleStillTag(subject, value, ownerSupport) {\n const lastSupport = subject.tagSupport;\n let templater = value;\n const isClass = isTagClass(value);\n if (isClass) {\n const tag = value;\n templater = tag.templater;\n if (!templater) {\n const children = new ValueSubject([]);\n templater = new TemplaterResult(undefined, children);\n templater.tag = tag;\n tag.templater = templater;\n }\n }\n const valueSupport = new TagSupport(templater, ownerSupport, subject);\n if (isClass) {\n valueSupport.global = lastSupport.global;\n }\n const isSameTag = value && isLikeTags(lastSupport, valueSupport);\n if (isTagTemplater(value)) {\n setupNewTemplater(valueSupport, ownerSupport, subject);\n }\n if (isSameTag) {\n lastSupport.updateBy(valueSupport);\n return;\n }\n if (isSameTag) {\n // const subjectTag = subject as TagSubject\n const global = lastSupport.global;\n const insertBefore = global.insertBefore;\n return processTag(templater, insertBefore, ownerSupport, subject);\n }\n return processRegularValue(value, subject, subject.insertBefore);\n}\nfunction prepareUpdateToComponent(templater, subjectTag, insertBefore, ownerSupport) {\n // When was something before component\n if (!subjectTag.tagSupport) {\n processSubjectComponent(templater, subjectTag, insertBefore, // oldInsertBefore as InsertBefore,\n ownerSupport, {\n forceElement: true,\n counts: { added: 0, removed: 0 },\n });\n return subjectTag;\n }\n const tagSupport = new TagSupport(templater, ownerSupport, subjectTag);\n // ??? new mirroring\n const subjectSup = subjectTag.tagSupport;\n // const prevSupport = (subjectSup.global.newest || subjectSup) as TagSupport\n const prevSupport = subjectSup.global.newest;\n if (prevSupport) {\n const newestState = prevSupport.memory.state;\n tagSupport.memory.state = [...newestState];\n }\n else {\n const placeholder = subjectSup.global.placeholder;\n if (placeholder && !insertBefore.parentNode) {\n insertAfter(insertBefore, placeholder);\n delete subjectSup.global.placeholder;\n }\n // insertBefore = subjectSup.global.placeholder || insertBefore\n processSubjectComponent(templater, subjectTag, insertBefore, ownerSupport, {\n forceElement: true,\n counts: { added: 0, removed: 0 },\n });\n return subjectTag;\n }\n tagSupport.global = subjectSup.global;\n subjectTag.tagSupport = tagSupport;\n updateExistingTagComponent(ownerSupport, tagSupport, // latest value\n subjectTag, insertBefore);\n return subjectTag;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// import { redrawTag } from \"./redrawTag.function\"\nimport { tagElement } from \"./tagElement\";\nexport * from \"./ElementTargetEvent.interface\";\nexport * from \"./tag\";\nexport * from \"./html\";\nexport * from \"./errors\";\nexport * from \"./subject/index\";\nexport * from \"./isInstance\";\nexport * from \"./state/index\";\nexport * from \"./TagSupport.class\";\n// export * from \"./redrawTag.function\"\nexport * from \"./interpolations/interpolateElement\";\n// TODO: export *\nexport { tagElement } from \"./tagElement\";\nexport { Tag } from \"./Tag.class\";\nexport { runBeforeRender } from \"./tagRunner\";\nexport { renderTagSupport } from \"./renderTagSupport.function\";\nexport const hmr = {\n tagElement,\n // redrawTag\n};\n"],"names":[],"sourceRoot":""}
|