@adminide-stack/yantra-mobile 12.0.128 → 12.0.129-alpha.1
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/lib/compute.js +57 -1
- package/lib/compute.js.map +1 -1
- package/lib/features/agent-chat/NativeAgentChat.js +3 -2
- package/lib/features/agent-chat/NativeAgentChat.js.map +1 -1
- package/lib/features/apps/AppsCatalog.js +10 -0
- package/lib/features/apps/AppsCatalog.js.map +1 -1
- package/lib/features/apps/mobileAppCatalog.js +11 -0
- package/lib/features/apps/mobileAppCatalog.js.map +1 -1
- package/lib/features/canvas/AudioEditorExperience.js +448 -105
- package/lib/features/canvas/AudioEditorExperience.js.map +1 -1
- package/lib/features/canvas/CanvasAgentChatPane.js +33 -14
- package/lib/features/canvas/CanvasAgentChatPane.js.map +1 -1
- package/lib/features/canvas/CanvasBoardsGrid.js +493 -41
- package/lib/features/canvas/CanvasBoardsGrid.js.map +1 -1
- package/lib/features/canvas/CanvasChatResultCard.js.map +1 -1
- package/lib/features/canvas/CanvasEditToolsPanel.js +37 -1
- package/lib/features/canvas/CanvasEditToolsPanel.js.map +1 -1
- package/lib/features/canvas/CanvasExperience.js +237 -22
- package/lib/features/canvas/CanvasExperience.js.map +1 -1
- package/lib/features/canvas/CanvasGeneratePanel.js +119 -26
- package/lib/features/canvas/CanvasGeneratePanel.js.map +1 -1
- package/lib/features/canvas/CanvasLooksPanel.js +17 -6
- package/lib/features/canvas/CanvasLooksPanel.js.map +1 -1
- package/lib/features/canvas/CanvasTasksPanel.js +18 -1
- package/lib/features/canvas/CanvasTasksPanel.js.map +1 -1
- package/lib/features/canvas/DesignCategoryGallery.js +423 -0
- package/lib/features/canvas/DesignCategoryGallery.js.map +1 -0
- package/lib/features/canvas/ImageEditorExperience.js +763 -187
- package/lib/features/canvas/ImageEditorExperience.js.map +1 -1
- package/lib/features/canvas/SetStudioExperience.js +199 -11
- package/lib/features/canvas/SetStudioExperience.js.map +1 -1
- package/lib/features/canvas/VideoEditorExperience.js +59 -40
- package/lib/features/canvas/VideoEditorExperience.js.map +1 -1
- package/lib/features/canvas/VideoGeneratorExperience.js +134 -34
- package/lib/features/canvas/VideoGeneratorExperience.js.map +1 -1
- package/lib/features/canvas/aiEdit.js +4 -2
- package/lib/features/canvas/aiEdit.js.map +1 -1
- package/lib/features/canvas/audioEditor/AudioWaveform.js +96 -0
- package/lib/features/canvas/audioEditor/AudioWaveform.js.map +1 -0
- package/lib/features/canvas/audioEditor/audioPeaks.js +93 -0
- package/lib/features/canvas/audioEditor/audioPeaks.js.map +1 -0
- package/lib/features/canvas/canvasTaskSync.js +34 -7
- package/lib/features/canvas/canvasTaskSync.js.map +1 -1
- package/lib/features/canvas/canvasTasks.js +23 -3
- package/lib/features/canvas/canvasTasks.js.map +1 -1
- package/lib/features/canvas/canvasTheme.js +10 -24
- package/lib/features/canvas/canvasTheme.js.map +1 -1
- package/lib/features/canvas/canvasUi.js +1 -1
- package/lib/features/canvas/canvasUi.js.map +1 -1
- package/lib/features/canvas/createTiles.js +17 -9
- package/lib/features/canvas/createTiles.js.map +1 -1
- package/lib/features/canvas/deepLinks.js +35 -5
- package/lib/features/canvas/deepLinks.js.map +1 -1
- package/lib/features/canvas/designCatalog.js +165 -0
- package/lib/features/canvas/designCatalog.js.map +1 -0
- package/lib/features/canvas/designCategories.js +262 -0
- package/lib/features/canvas/designCategories.js.map +1 -0
- package/lib/features/canvas/editorControls.js +406 -0
- package/lib/features/canvas/editorControls.js.map +1 -0
- package/lib/features/canvas/generationModels.js +5 -3
- package/lib/features/canvas/generationModels.js.map +1 -1
- package/lib/features/canvas/generationTasks.js +162 -0
- package/lib/features/canvas/generationTasks.js.map +1 -0
- package/lib/features/canvas/generator/BottomSheet.js +167 -0
- package/lib/features/canvas/generator/BottomSheet.js.map +1 -0
- package/lib/features/canvas/generator/BusinessCardChatCard.js +155 -0
- package/lib/features/canvas/generator/BusinessCardChatCard.js.map +1 -0
- package/lib/features/canvas/generator/DirectorSheet.js +163 -0
- package/lib/features/canvas/generator/DirectorSheet.js.map +1 -0
- package/lib/features/canvas/generator/ReframePreview.js +122 -0
- package/lib/features/canvas/generator/ReframePreview.js.map +1 -0
- package/lib/features/canvas/generator/RunLogCard.js +119 -0
- package/lib/features/canvas/generator/RunLogCard.js.map +1 -0
- package/lib/features/canvas/generator/ShotPanel.js +261 -0
- package/lib/features/canvas/generator/ShotPanel.js.map +1 -0
- package/lib/features/canvas/generator/businessCardWidget.js +117 -0
- package/lib/features/canvas/generator/businessCardWidget.js.map +1 -0
- package/lib/features/canvas/generator/cameraVocabulary.js +142 -0
- package/lib/features/canvas/generator/cameraVocabulary.js.map +1 -0
- package/lib/features/canvas/generator/cinematicVocabulary.js +416 -0
- package/lib/features/canvas/generator/cinematicVocabulary.js.map +1 -0
- package/lib/features/canvas/generator/direction.js +41 -0
- package/lib/features/canvas/generator/direction.js.map +1 -0
- package/lib/features/canvas/generator/reframeGeometry.js +108 -0
- package/lib/features/canvas/generator/reframeGeometry.js.map +1 -0
- package/lib/features/canvas/generator/runLog.js +71 -0
- package/lib/features/canvas/generator/runLog.js.map +1 -0
- package/lib/features/canvas/generator/shot.js +133 -0
- package/lib/features/canvas/generator/shot.js.map +1 -0
- package/lib/features/canvas/generator/useShotSpec.js +87 -0
- package/lib/features/canvas/generator/useShotSpec.js.map +1 -0
- package/lib/features/canvas/home/HeroComposer.js +214 -0
- package/lib/features/canvas/home/HeroComposer.js.map +1 -0
- package/lib/features/canvas/home/HeroMonitor.js +225 -0
- package/lib/features/canvas/home/HeroMonitor.js.map +1 -0
- package/lib/features/canvas/home/LookDetail.js +185 -0
- package/lib/features/canvas/home/LookDetail.js.map +1 -0
- package/lib/features/canvas/home/LoopingVideo.js +37 -0
- package/lib/features/canvas/home/LoopingVideo.js.map +1 -0
- package/lib/features/canvas/home/TemplatesGallery.js +253 -0
- package/lib/features/canvas/home/TemplatesGallery.js.map +1 -0
- package/lib/features/canvas/home/heroShots.js +100 -0
- package/lib/features/canvas/home/heroShots.js.map +1 -0
- package/lib/features/canvas/homeWork.js +62 -3
- package/lib/features/canvas/homeWork.js.map +1 -1
- package/lib/features/canvas/imageEditor/ImageMarkup.js +195 -0
- package/lib/features/canvas/imageEditor/ImageMarkup.js.map +1 -0
- package/lib/features/canvas/imageEditor/imageEditOps.js +367 -0
- package/lib/features/canvas/imageEditor/imageEditOps.js.map +1 -0
- package/lib/features/canvas/nativeViewerRegistry.js.map +1 -1
- package/lib/features/canvas/rankedCatalogSearch.js +375 -0
- package/lib/features/canvas/rankedCatalogSearch.js.map +1 -0
- package/lib/features/canvas/recorder/CameraRecorderExperience.js +68 -20
- package/lib/features/canvas/recorder/CameraRecorderExperience.js.map +1 -1
- package/lib/features/canvas/recorder/RecordingReview.js +272 -0
- package/lib/features/canvas/recorder/RecordingReview.js.map +1 -0
- package/lib/features/canvas/recorder/RecordingsList.js +179 -0
- package/lib/features/canvas/recorder/RecordingsList.js.map +1 -0
- package/lib/features/canvas/recorder/recorderOps.js +99 -0
- package/lib/features/canvas/recorder/recorderOps.js.map +1 -0
- package/lib/features/canvas/seedanceShowcase.js +314 -0
- package/lib/features/canvas/seedanceShowcase.js.map +1 -0
- package/lib/features/canvas/serverTasks.js +149 -15
- package/lib/features/canvas/serverTasks.js.map +1 -1
- package/lib/features/canvas/sessionRenewal.js +114 -0
- package/lib/features/canvas/sessionRenewal.js.map +1 -0
- package/lib/features/canvas/set/SetViewportWebView.js +34 -1
- package/lib/features/canvas/set/SetViewportWebView.js.map +1 -1
- package/lib/features/canvas/set/agent/setTurn.js +4 -2
- package/lib/features/canvas/set/agent/setTurn.js.map +1 -1
- package/lib/features/canvas/set/setPresets.js +85 -0
- package/lib/features/canvas/set/setPresets.js.map +1 -0
- package/lib/features/canvas/set/setProject.js +4 -1
- package/lib/features/canvas/set/setProject.js.map +1 -1
- package/lib/features/canvas/studioCatalog.js +59 -4
- package/lib/features/canvas/studioCatalog.js.map +1 -1
- package/lib/features/canvas/studioLooks.js +31 -4
- package/lib/features/canvas/studioLooks.js.map +1 -1
- package/lib/features/canvas/surfaceIndex.js +1 -14
- package/lib/features/canvas/surfaceIndex.js.map +1 -1
- package/lib/features/canvas/templateSearch.js +489 -0
- package/lib/features/canvas/templateSearch.js.map +1 -0
- package/lib/features/canvas/useCanvasSession.js +28 -6
- package/lib/features/canvas/useCanvasSession.js.map +1 -1
- package/lib/features/canvas/useStudioCatalogTemplates.js +41 -5
- package/lib/features/canvas/useStudioCatalogTemplates.js.map +1 -1
- package/lib/features/canvas/videoEditor/EditorPanels.js +531 -0
- package/lib/features/canvas/videoEditor/EditorPanels.js.map +1 -0
- package/lib/features/canvas/videoEditor/agent/AgentCutPane.js +48 -4
- package/lib/features/canvas/videoEditor/agent/AgentCutPane.js.map +1 -1
- package/lib/features/canvas/videoEditor/agent/agentLoop.js +2 -0
- package/lib/features/canvas/videoEditor/agent/agentLoop.js.map +1 -1
- package/lib/features/canvas/videoEditor/agent/brainClient.js +97 -27
- package/lib/features/canvas/videoEditor/agent/brainClient.js.map +1 -1
- package/lib/features/canvas/videoEditor/agent/cutTools.js +707 -3
- package/lib/features/canvas/videoEditor/agent/cutTools.js.map +1 -1
- package/lib/features/canvas/videoEditor/audioServices.js +165 -0
- package/lib/features/canvas/videoEditor/audioServices.js.map +1 -0
- package/lib/features/canvas/videoEditor/captions.js +144 -0
- package/lib/features/canvas/videoEditor/captions.js.map +1 -0
- package/lib/features/canvas/videoEditor/compileTimeline.js +24 -16
- package/lib/features/canvas/videoEditor/compileTimeline.js.map +1 -1
- package/lib/features/canvas/videoEditor/editorModel.js +12 -2
- package/lib/features/canvas/videoEditor/editorModel.js.map +1 -1
- package/lib/features/canvas/videoEditor/exportTask.js +89 -7
- package/lib/features/canvas/videoEditor/exportTask.js.map +1 -1
- package/lib/features/canvas/videoEditor/layers.js +117 -0
- package/lib/features/canvas/videoEditor/layers.js.map +1 -0
- package/lib/features/canvas/videoEditor/remoteMediaClient.js +45 -18
- package/lib/features/canvas/videoEditor/remoteMediaClient.js.map +1 -1
- package/lib/features/canvas/videoEditor/renderTimeline.js +18 -6
- package/lib/features/canvas/videoEditor/renderTimeline.js.map +1 -1
- package/lib/features/canvas/videoEditor/revoice.js +138 -0
- package/lib/features/canvas/videoEditor/revoice.js.map +1 -0
- package/lib/features/canvas/videoEditor/storageUpload.js +34 -0
- package/lib/features/canvas/videoEditor/storageUpload.js.map +1 -0
- package/lib/features/canvas/videoEditor/textMotion.js +109 -0
- package/lib/features/canvas/videoEditor/textMotion.js.map +1 -0
- package/lib/features/canvas/videoEditor/transitions.js +31 -0
- package/lib/features/canvas/videoEditor/transitions.js.map +1 -0
- package/lib/features/chat/TemplatesChatCards.js +8 -3
- package/lib/features/chat/TemplatesChatCards.js.map +1 -1
- package/lib/features/design/DesignEditorExperience.js +674 -644
- package/lib/features/design/DesignEditorExperience.js.map +1 -1
- package/lib/features/design/DesignExperience.js +285 -538
- package/lib/features/design/DesignExperience.js.map +1 -1
- package/lib/features/design/designCore.js +2 -212
- package/lib/features/design/designCore.js.map +1 -1
- package/lib/features/design/designIndex.js +1 -50
- package/lib/features/design/designIndex.js.map +1 -1
- package/lib/features/design/doc/aiDesign.js +247 -0
- package/lib/features/design/doc/aiDesign.js.map +1 -0
- package/lib/features/design/doc/artifacts.js +280 -0
- package/lib/features/design/doc/artifacts.js.map +1 -0
- package/lib/features/design/doc/chart.js +98 -0
- package/lib/features/design/doc/chart.js.map +1 -0
- package/lib/features/design/doc/crop.js +104 -0
- package/lib/features/design/doc/crop.js.map +1 -0
- package/lib/features/design/doc/curve.js +49 -0
- package/lib/features/design/doc/curve.js.map +1 -0
- package/lib/features/design/doc/docOps.js +397 -0
- package/lib/features/design/doc/docOps.js.map +1 -0
- package/lib/features/design/doc/findReplace.js +112 -0
- package/lib/features/design/doc/findReplace.js.map +1 -0
- package/lib/features/design/doc/fonts.js +79 -0
- package/lib/features/design/doc/fonts.js.map +1 -0
- package/lib/features/design/doc/frames.js +17 -0
- package/lib/features/design/doc/frames.js.map +1 -0
- package/lib/features/design/doc/geometry.js +133 -0
- package/lib/features/design/doc/geometry.js.map +1 -0
- package/lib/features/design/doc/imageAdjust.js +203 -0
- package/lib/features/design/doc/imageAdjust.js.map +1 -0
- package/lib/features/design/doc/legacyDoc.js +107 -0
- package/lib/features/design/doc/legacyDoc.js.map +1 -0
- package/lib/features/design/doc/newDoc.js +335 -0
- package/lib/features/design/doc/newDoc.js.map +1 -0
- package/lib/features/design/doc/pageRange.js +17 -0
- package/lib/features/design/doc/pageRange.js.map +1 -0
- package/lib/features/design/doc/pathScale.js +68 -0
- package/lib/features/design/doc/pathScale.js.map +1 -0
- package/lib/features/design/doc/qr.js +62 -0
- package/lib/features/design/doc/qr.js.map +1 -0
- package/lib/features/design/doc/shapes.js +366 -0
- package/lib/features/design/doc/shapes.js.map +1 -0
- package/lib/features/design/doc/sizes.js +230 -0
- package/lib/features/design/doc/sizes.js.map +1 -0
- package/lib/features/design/doc/textEffects.js +134 -0
- package/lib/features/design/doc/textEffects.js.map +1 -0
- package/lib/features/design/doc/textLayout.js +182 -0
- package/lib/features/design/doc/textLayout.js.map +1 -0
- package/lib/features/design/doc/types.js +30 -0
- package/lib/features/design/doc/types.js.map +1 -0
- package/lib/features/design/editor/AiPanel.js +194 -0
- package/lib/features/design/editor/AiPanel.js.map +1 -0
- package/lib/features/design/editor/ChartDataPanel.js +182 -0
- package/lib/features/design/editor/ChartDataPanel.js.map +1 -0
- package/lib/features/design/editor/CropOverlay.js +199 -0
- package/lib/features/design/editor/CropOverlay.js.map +1 -0
- package/lib/features/design/editor/DesignCanvas.js +363 -0
- package/lib/features/design/editor/DesignCanvas.js.map +1 -0
- package/lib/features/design/editor/ExportSheet.js +123 -0
- package/lib/features/design/editor/ExportSheet.js.map +1 -0
- package/lib/features/design/editor/FindReplacePanel.js +93 -0
- package/lib/features/design/editor/FindReplacePanel.js.map +1 -0
- package/lib/features/design/editor/ImageTools.js +188 -0
- package/lib/features/design/editor/ImageTools.js.map +1 -0
- package/lib/features/design/editor/LayerTools.js +485 -0
- package/lib/features/design/editor/LayerTools.js.map +1 -0
- package/lib/features/design/editor/PageStrip.js +203 -0
- package/lib/features/design/editor/PageStrip.js.map +1 -0
- package/lib/features/design/editor/Slideshow.js +97 -0
- package/lib/features/design/editor/Slideshow.js.map +1 -0
- package/lib/features/design/editor/ToolPanels.js +695 -0
- package/lib/features/design/editor/ToolPanels.js.map +1 -0
- package/lib/features/design/editor/controls.js +630 -0
- package/lib/features/design/editor/controls.js.map +1 -0
- package/lib/features/design/editor/useDesignSave.js +91 -0
- package/lib/features/design/editor/useDesignSave.js.map +1 -0
- package/lib/features/design/export/exportDesign.js +170 -0
- package/lib/features/design/export/exportDesign.js.map +1 -0
- package/lib/features/design/export/pdf.js +143 -0
- package/lib/features/design/export/pdf.js.map +1 -0
- package/lib/features/design/home/DesignHome.js +688 -0
- package/lib/features/design/home/DesignHome.js.map +1 -0
- package/lib/features/design/home/studioHome.js +61 -0
- package/lib/features/design/home/studioHome.js.map +1 -0
- package/lib/features/design/pickDesignImage.js +60 -0
- package/lib/features/design/pickDesignImage.js.map +1 -0
- package/lib/features/design/render/DesignPageView.js +69 -0
- package/lib/features/design/render/DesignPageView.js.map +1 -0
- package/lib/features/design/render/PageCapture.js +288 -0
- package/lib/features/design/render/PageCapture.js.map +1 -0
- package/lib/features/design/render/TextMeasure.js +115 -0
- package/lib/features/design/render/TextMeasure.js.map +1 -0
- package/lib/features/design/render/fontRegistry.js +110 -0
- package/lib/features/design/render/fontRegistry.js.map +1 -0
- package/lib/features/design/render/layers.js +392 -0
- package/lib/features/design/render/layers.js.map +1 -0
- package/lib/features/design/render/svg.js +35 -0
- package/lib/features/design/render/svg.js.map +1 -0
- package/lib/features/design/render/svgParts.js +435 -0
- package/lib/features/design/render/svgParts.js.map +1 -0
- package/lib/features/design/surface/BoardScreen.js +529 -0
- package/lib/features/design/surface/BoardScreen.js.map +1 -0
- package/lib/features/design/surface/CompareView.js +138 -0
- package/lib/features/design/surface/CompareView.js.map +1 -0
- package/lib/features/design/surface/CreationScreen.js +294 -0
- package/lib/features/design/surface/CreationScreen.js.map +1 -0
- package/lib/features/design/surface/DesignAgentChatPane.js +444 -0
- package/lib/features/design/surface/DesignAgentChatPane.js.map +1 -0
- package/lib/features/design/surface/DesignBoards.js +441 -0
- package/lib/features/design/surface/DesignBoards.js.map +1 -0
- package/lib/features/design/surface/DesignPreview.js +159 -0
- package/lib/features/design/surface/DesignPreview.js.map +1 -0
- package/lib/features/design/surface/DesignSurfaceExperience.js +80 -0
- package/lib/features/design/surface/DesignSurfaceExperience.js.map +1 -0
- package/lib/features/design/surface/FullScreenPreview.js +59 -0
- package/lib/features/design/surface/FullScreenPreview.js.map +1 -0
- package/lib/features/design/surface/NewSystemDialog.js +122 -0
- package/lib/features/design/surface/NewSystemDialog.js.map +1 -0
- package/lib/features/design/surface/PickerSheet.js +175 -0
- package/lib/features/design/surface/PickerSheet.js.map +1 -0
- package/lib/features/design/surface/TemplatesGallery.js +156 -0
- package/lib/features/design/surface/TemplatesGallery.js.map +1 -0
- package/lib/features/design/surface/WetPaint.js +140 -0
- package/lib/features/design/surface/WetPaint.js.map +1 -0
- package/lib/features/design/surface/agentTurn.js +229 -0
- package/lib/features/design/surface/agentTurn.js.map +1 -0
- package/lib/features/design/surface/designBoard.js +218 -0
- package/lib/features/design/surface/designBoard.js.map +1 -0
- package/lib/features/design/surface/designChannel.js +186 -0
- package/lib/features/design/surface/designChannel.js.map +1 -0
- package/lib/features/design/surface/designChat.js +141 -0
- package/lib/features/design/surface/designChat.js.map +1 -0
- package/lib/features/design/surface/designConnector.js +266 -0
- package/lib/features/design/surface/designConnector.js.map +1 -0
- package/lib/features/design/surface/designDocument.js +40 -0
- package/lib/features/design/surface/designDocument.js.map +1 -0
- package/lib/features/design/surface/designExport.js +55 -0
- package/lib/features/design/surface/designExport.js.map +1 -0
- package/lib/features/design/surface/designLinks.js +64 -0
- package/lib/features/design/surface/designLinks.js.map +1 -0
- package/lib/features/design/surface/designPalette.js +24 -0
- package/lib/features/design/surface/designPalette.js.map +1 -0
- package/lib/features/design/surface/designRun.js +161 -0
- package/lib/features/design/surface/designRun.js.map +1 -0
- package/lib/features/design/surface/designTheme.js +119 -0
- package/lib/features/design/surface/designTheme.js.map +1 -0
- package/lib/features/design/surface/execStream.js +206 -0
- package/lib/features/design/surface/execStream.js.map +1 -0
- package/lib/features/design/surface/metaball.js +48 -0
- package/lib/features/design/surface/metaball.js.map +1 -0
- package/lib/features/design/surface/pickReferenceFiles.js +35 -0
- package/lib/features/design/surface/pickReferenceFiles.js.map +1 -0
- package/lib/features/design/surface/useDesignSurface.js +379 -0
- package/lib/features/design/surface/useDesignSurface.js.map +1 -0
- package/lib/features/docs/DocBlockRow.js +336 -0
- package/lib/features/docs/DocBlockRow.js.map +1 -0
- package/lib/features/docs/DocsEditorExperience.js +949 -0
- package/lib/features/docs/DocsEditorExperience.js.map +1 -0
- package/lib/features/docs/DocsToolbar.js +247 -0
- package/lib/features/docs/DocsToolbar.js.map +1 -0
- package/lib/features/docs/blocks.js +560 -0
- package/lib/features/docs/blocks.js.map +1 -0
- package/lib/features/docs/docArtifacts.js +129 -0
- package/lib/features/docs/docArtifacts.js.map +1 -0
- package/lib/features/docs/docEdits.js +201 -0
- package/lib/features/docs/docEdits.js.map +1 -0
- package/lib/features/docs/docExport.js +235 -0
- package/lib/features/docs/docExport.js.map +1 -0
- package/lib/features/docs/docShare.js +62 -0
- package/lib/features/docs/docShare.js.map +1 -0
- package/lib/features/links/openInApp.js +38 -2
- package/lib/features/links/openInApp.js.map +1 -1
- package/lib/routes.json +54 -0
- package/lib/screens/DesignNative/index.js +35 -0
- package/lib/screens/DesignNative/index.js.map +1 -0
- package/package.json +4 -4
- package/lib/features/design/exportDesign.js +0 -133
- package/lib/features/design/exportDesign.js.map +0 -1
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
function unicodeRegExp(source, flags, fallback) {
|
|
18
|
+
try {
|
|
19
|
+
return new RegExp(source, `${flags}u`);
|
|
20
|
+
} catch (e) {
|
|
21
|
+
return fallback;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const NON_WORD = unicodeRegExp("[^\\p{L}\\p{N}]+", "", /[^A-Za-z0-9\u00C0-\u024F]+/);
|
|
25
|
+
const NON_WORD_ALL = unicodeRegExp("[^\\p{L}\\p{N}]+", "g", /[^A-Za-z0-9\u00C0-\u024F]+/g);
|
|
26
|
+
const WORD_END = unicodeRegExp("[\\p{L}\\p{N}]$", "", /[A-Za-z0-9\u00C0-\u024F]$/);
|
|
27
|
+
const MAX_CONCEPTS = 8;
|
|
28
|
+
const FILLER = new Set("a an the and or of for in on at to from by with without about into onto over under as is are be my our your their his her its me i we you us it this that these those some any all every each one ones template templates design designs designed idea ideas example examples sample samples option options show find search make create build need needs want looking look get give please new best good great nice cool really very something kind type types version style styles styled theme themed based using use free just also like more other etc page pages custom editable own quick easy pro printable print ready can could would should will do does help thanks hi hello want wanted some something someone pick choose choice list see view".split(" "));
|
|
29
|
+
const STYLE_GROUPS = [["clean", "minimal", "minimalist", "simple", "crisp", "tidy", "uncluttered"], ["minimal", "minimalist", "simple", "clean", "minimalistic", "minimalism", "plain"], ["simple", "minimal", "minimalist", "clean", "basic", "plain"], ["modern", "contemporary", "sleek", "trendy"], ["fancy", "elegant", "luxury", "gold", "premium", "luxurious", "golden", "sophisticated", "classy", "glamorous", "chic", "ornate", "upscale"], ["elegant", "sophisticated", "luxury", "classy", "refined", "graceful", "chic", "elegance", "fancy"], ["luxury", "luxurious", "premium", "gold", "elegant", "upscale", "golden", "fancy"], ["bold", "vibrant", "striking", "strong", "punchy", "loud"], ["playful", "fun", "cute", "colorful", "whimsical", "cheerful", "quirky", "cartoon"], ["fun", "playful", "colorful", "cheerful", "cute"], ["cute", "playful", "adorable", "sweet", "kawaii"], ["warm", "cozy", "earthy", "beige", "cream", "terracotta"], ["professional", "corporate", "formal", "businesslike"], ["corporate", "professional", "formal"], ["formal", "professional", "classic"], ["classic", "timeless", "traditional", "vintage"], ["vintage", "retro", "antique", "nostalgic", "classic", "risograph"], ["retro", "vintage", "groovy", "nostalgic"], ["rustic", "kraft", "wooden", "farmhouse", "earthy"], ["creative", "artistic", "unique", "abstract"], ["colorful", "vibrant", "bright", "colourful", "rainbow", "multicolor", "multicolored"], ["bright", "vibrant", "colorful", "neon"], ["dark", "black", "moody"], ["light", "white", "airy"], ["pastel", "soft", "muted", "gentle"], ["soft", "pastel", "gentle", "muted"], ["floral", "flower", "botanical", "blossom"], ["geometric", "shapes", "angular", "lines"], ["abstract", "shapes", "artistic"], ["gradient", "ombre"], ["watercolor", "watercolour", "painted", "painterly"], ["illustrated", "illustration", "illustrative", "drawn", "handdrawn", "doodle", "cartoon", "sketch"], ["futuristic", "neon", "cyber", "scifi"], ["feminine", "pink", "girly", "delicate"], ["masculine", "rugged"], ["beautiful", "elegant", "pretty", "stunning", "lovely", "aesthetic", "gorgeous"], ["stylish", "chic", "trendy", "fashionable"], ["friendly", "approachable", "welcoming", "casual"], ["casual", "relaxed", "friendly"], ["calm", "serene", "peaceful", "zen", "tranquil"], ["monochrome", "monochromatic", "grayscale"], ["grunge", "textured", "distressed"], ["handwritten", "script", "calligraphy"], ["typographic", "typography", "lettering"], ["sleek", "modern", "smooth", "minimal"], ["gray", "grey"], ["gold", "golden"], ["purple", "violet", "plum", "lavender"], ["beige", "cream", "ivory", "tan"], ["black"], ["white"], ["silver"], ["blue"], ["navy"], ["green"], ["red"], ["pink"], ["yellow"], ["orange"], ["brown"], ["teal"], ["turquoise"], ["mint"], ["maroon"], ["burgundy"], ["peach"], ["coral"], ["olive"], ["sage"], ["mustard"], ["emerald"], ["neon"]];
|
|
30
|
+
const SUBJECT_GROUPS = [["store", "shop", "boutique", "retail", "storefront"], ["shop", "store", "boutique", "retail", "shopping"], ["opening", "grand opening", "launch", "inauguration", "reopening"], ["coffee", "cafe", "espresso", "barista", "coffeehouse", "latte"], ["cafe", "coffee", "coffeehouse", "bistro"], ["bakery", "baker", "baking", "bakeshop", "pastry", "patisserie", "bread", "cake", "cupcake"], ["cake", "cupcake", "bakery", "dessert", "pastry"], ["restaurant", "dining", "diner", "bistro", "eatery", "cuisine"], ["food", "culinary", "meal", "kitchen", "cooking"], ["chef", "cook", "culinary", "catering"], ["roadmap", "road map", "timeline", "milestone"], ["ice cream", "gelato", "dessert"], ["social media", "instagram", "facebook", "tiktok"], ["strategy", "strategic", "planning"], ["plan", "planning", "planner"], ["real estate", "realtor", "realty", "property", "housing"], ["realtor", "real estate", "realty", "property"], ["home", "house"], ["lawyer", "attorney", "law", "legal"], ["attorney", "lawyer", "law", "legal"], ["doctor", "medical", "clinic", "physician", "healthcare"], ["dentist", "dental", "orthodontist"], ["health", "healthcare", "wellness", "medical"], ["fitness", "gym", "workout", "trainer", "exercise"], ["gym", "fitness", "workout"], ["yoga", "pilates", "meditation"], ["wedding", "bridal", "bride", "marriage"], ["birthday", "bday"], ["party", "celebration", "fiesta"], ["photography", "photographer", "photo", "camera"], ["photographer", "photography", "photo"], ["beauty", "salon", "makeup", "cosmetics", "spa"], ["salon", "hair", "hairdresser", "hairstylist", "beauty"], ["barber", "barbershop", "hair"], ["technology", "tech", "software", "digital"], ["tech", "technology", "software"], ["startup", "venture", "founder"], ["pitch", "investor", "funding", "fundraising"], ["marketing", "advertising", "campaign", "promotion"], ["brand", "branding", "identity"], ["sale", "discount", "promo", "offer", "deal", "clearance"], ["church", "worship", "ministry", "faith"], ["school", "education", "classroom", "student", "teacher"], ["education", "school", "learning", "teaching", "classroom"], ["music", "band", "concert", "musician"], ["travel", "trip", "tourism", "vacation", "tour"], ["hotel", "resort", "hospitality"], ["cleaning", "cleaner", "janitorial", "housekeeping", "maid"], ["construction", "builder", "contractor", "renovation"], ["car", "auto", "automotive", "mechanic", "garage", "vehicle"], ["pet", "dog", "cat", "veterinary", "vet", "grooming"], ["finance", "financial", "accounting", "accountant", "bank", "investment"], ["accountant", "accounting", "bookkeeping", "tax"], ["consulting", "consultant", "advisory", "advisor"], ["charity", "nonprofit", "fundraiser", "donation", "volunteer"], ["fashion", "clothing", "apparel"], ["garden", "gardening", "landscaping", "lawn"], ["event", "conference", "summit", "meetup"], ["christmas", "xmas"], ["kids", "children", "child"], ["report", "review", "summary"], ["webinar", "workshop", "seminar"], ["farm", "farming", "agriculture"], ["sustainability", "sustainable", "environment", "eco", "climate"], ["science", "research", "laboratory"], ["art", "artist", "gallery"], ["coach", "coaching", "mentor"], ["therapy", "therapist", "counseling", "counselor"], ["massage", "spa", "therapist"], ["plumber", "plumbing", "handyman", "repair"], ["delivery", "courier", "logistics", "shipping"], ["bar", "pub", "cocktail", "brewery"], ["wine", "winery", "vineyard"], ["pizza", "pizzeria"], ["tea", "teahouse"]];
|
|
31
|
+
const TEMPLATE_CATEGORY_WORDS = {
|
|
32
|
+
slideDeck: ["presentation", "slide", "slides", "deck", "ppt", "pptx", "powerpoint", "keynote", "slideshow", "google slides"],
|
|
33
|
+
socialPost: ["social media post", "social post", "post", "posts", "social media"],
|
|
34
|
+
carousel: ["carousel", "carousels", "instagram carousel"],
|
|
35
|
+
flyer: ["flyer", "flier", "poster", "leaflet", "handout"],
|
|
36
|
+
businessCard: ["business card", "visiting card", "calling card", "card"],
|
|
37
|
+
logo: ["logo", "logos", "logotype", "emblem"],
|
|
38
|
+
banner: ["banner"],
|
|
39
|
+
brochure: ["brochure", "pamphlet", "trifold", "tri fold"],
|
|
40
|
+
branding: ["branding kit", "stationery"],
|
|
41
|
+
certificate: ["certificate"],
|
|
42
|
+
worksheet: ["worksheet"],
|
|
43
|
+
proposal: ["proposal"],
|
|
44
|
+
newsletter: ["newsletter"],
|
|
45
|
+
menu: ["menu"],
|
|
46
|
+
infographic: ["infographic"],
|
|
47
|
+
imageGeneration: ["image", "picture", "prompt"],
|
|
48
|
+
videoGeneration: ["video", "clip", "reel"],
|
|
49
|
+
audioGeneration: ["audio", "sound", "song", "track"]
|
|
50
|
+
};
|
|
51
|
+
const KEEP_S = /* @__PURE__ */ new Set(["news", "series", "species", "physics", "mathematics", "economics", "analytics", "ethics", "politics", "athletics", "aesthetics", "lyrics", "diabetes", "canvas", "christmas", "xmas", "texas", "paris", "atlas", "gas", "bus", "plus", "yes", "its", "this", "thus", "chaos", "cosmos", "logistics", "graphics", "kids"]);
|
|
52
|
+
function stemWord(word) {
|
|
53
|
+
const w = word.toLowerCase();
|
|
54
|
+
if (w.length <= 3 || /\d/.test(w) || KEEP_S.has(w)) return w;
|
|
55
|
+
if (w.endsWith("ies") && w.length > 4) return `${w.slice(0, -3)}y`;
|
|
56
|
+
if (/(ss|us|is)$/.test(w)) return w;
|
|
57
|
+
if (/(sses|ches|shes|xes|zes)$/.test(w)) return w.slice(0, -2);
|
|
58
|
+
if (w.endsWith("s")) return w.slice(0, -1);
|
|
59
|
+
return w;
|
|
60
|
+
}
|
|
61
|
+
function fold(text) {
|
|
62
|
+
let normalized = text;
|
|
63
|
+
try {
|
|
64
|
+
if (typeof text.normalize === "function") normalized = text.normalize("NFKD");
|
|
65
|
+
} catch (e) {
|
|
66
|
+
}
|
|
67
|
+
return normalized.replace(/[\u0300-\u036f]/g, "").replace(/[\u2018\u2019\u02bc]/g, "'").replace(/&/g, " and ").toLowerCase();
|
|
68
|
+
}
|
|
69
|
+
function searchWords(text) {
|
|
70
|
+
return fold(text).split(NON_WORD).filter((w) => w.length > 1).map(stemWord);
|
|
71
|
+
}
|
|
72
|
+
function editDistance(a, b, max) {
|
|
73
|
+
if (Math.abs(a.length - b.length) > max) return max + 1;
|
|
74
|
+
const rows = [];
|
|
75
|
+
for (let i = 0; i <= a.length; i++) {
|
|
76
|
+
rows.push([i]);
|
|
77
|
+
}
|
|
78
|
+
for (let j = 1; j <= b.length; j++) rows[0][j] = j;
|
|
79
|
+
for (let i = 1; i <= a.length; i++) {
|
|
80
|
+
let best = Infinity;
|
|
81
|
+
for (let j = 1; j <= b.length; j++) {
|
|
82
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
83
|
+
let d = Math.min(rows[i - 1][j] + 1, rows[i][j - 1] + 1, rows[i - 1][j - 1] + cost);
|
|
84
|
+
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) d = Math.min(d, rows[i - 2][j - 2] + 1);
|
|
85
|
+
rows[i][j] = d;
|
|
86
|
+
if (d < best) best = d;
|
|
87
|
+
}
|
|
88
|
+
if (best > max) return max + 1;
|
|
89
|
+
}
|
|
90
|
+
return rows[a.length][b.length];
|
|
91
|
+
}
|
|
92
|
+
function nearMap(groups) {
|
|
93
|
+
const own = /* @__PURE__ */ new Map();
|
|
94
|
+
const heads = /* @__PURE__ */ new Map();
|
|
95
|
+
const push = (map2, key, value) => {
|
|
96
|
+
var _a;
|
|
97
|
+
const list = (_a = map2.get(key)) != null ? _a : [];
|
|
98
|
+
if (value !== key && !list.includes(value)) list.push(value);
|
|
99
|
+
map2.set(key, list);
|
|
100
|
+
};
|
|
101
|
+
for (const group of groups) {
|
|
102
|
+
const [head, ...rest] = group.map((w) => searchWords(w).join(" "));
|
|
103
|
+
if (!own.has(head)) own.set(head, []);
|
|
104
|
+
for (const w of rest) {
|
|
105
|
+
push(own, head, w);
|
|
106
|
+
push(heads, w, head);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const map = /* @__PURE__ */ new Map();
|
|
110
|
+
for (const [word, list] of heads) if (!own.has(word)) map.set(word, list);
|
|
111
|
+
for (const [word, list] of own) map.set(word, list);
|
|
112
|
+
return map;
|
|
113
|
+
}
|
|
114
|
+
const STYLE_NEAR = nearMap(STYLE_GROUPS);
|
|
115
|
+
const SUBJECT_NEAR = nearMap(SUBJECT_GROUPS);
|
|
116
|
+
const LISTED = /* @__PURE__ */ new Map();
|
|
117
|
+
const TYPO_TARGETS = /* @__PURE__ */ new Set();
|
|
118
|
+
const LONG_TYPO_TARGETS = /* @__PURE__ */ new Set();
|
|
119
|
+
const KNOWN = /* @__PURE__ */ new Set();
|
|
120
|
+
{
|
|
121
|
+
const add = (w, target) => {
|
|
122
|
+
for (const part of fold(w).split(NON_WORD)) {
|
|
123
|
+
if (part.length < 2) continue;
|
|
124
|
+
const stem = stemWord(part);
|
|
125
|
+
KNOWN.add(stem);
|
|
126
|
+
if (!LISTED.has(stem)) LISTED.set(stem, part);
|
|
127
|
+
if (target) TYPO_TARGETS.add(stem);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
FILLER.forEach((w) => add(w, true));
|
|
131
|
+
for (const g of STYLE_GROUPS) g.forEach((w) => add(w, true));
|
|
132
|
+
for (const words of Object.values(TEMPLATE_CATEGORY_WORDS)) words.forEach((w) => add(w, true));
|
|
133
|
+
["templates", "business"].forEach((w) => add(w, true));
|
|
134
|
+
for (const g of SUBJECT_GROUPS) g.forEach((w) => add(w, false));
|
|
135
|
+
for (const g of SUBJECT_GROUPS) for (const w of g) if (!w.includes(" ") && w.length >= 8) LONG_TYPO_TARGETS.add(stemWord(w));
|
|
136
|
+
}
|
|
137
|
+
function fixTypo(stem) {
|
|
138
|
+
if (stem.length < 5 || /\d/.test(stem) || KNOWN.has(stem)) return stem;
|
|
139
|
+
let best = "";
|
|
140
|
+
let bestDistance = Infinity;
|
|
141
|
+
const consider = (targets, max) => {
|
|
142
|
+
for (const known of targets) {
|
|
143
|
+
if (known[0] !== stem[0] || known.length < 4) continue;
|
|
144
|
+
const d = editDistance(stem, known, max);
|
|
145
|
+
if (d <= max && d < bestDistance) {
|
|
146
|
+
best = known;
|
|
147
|
+
bestDistance = d;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
consider(TYPO_TARGETS, stem.length >= 8 ? 2 : 1);
|
|
152
|
+
if (stem.length >= 8) consider(LONG_TYPO_TARGETS, 1);
|
|
153
|
+
return best || stem;
|
|
154
|
+
}
|
|
155
|
+
function removePhrase(tokens, phrase, removed) {
|
|
156
|
+
if (phrase.length === 0) return tokens;
|
|
157
|
+
const out = [];
|
|
158
|
+
for (let i = 0; i < tokens.length; ) {
|
|
159
|
+
const hit = i + phrase.length <= tokens.length && phrase.every((p, k) => tokens[i + k].stem === p || fixTypo(tokens[i + k].stem) === p);
|
|
160
|
+
if (hit) {
|
|
161
|
+
removed.push(tokens.slice(i, i + phrase.length).map((t) => t.raw).join(" "));
|
|
162
|
+
i += phrase.length;
|
|
163
|
+
} else {
|
|
164
|
+
out.push(tokens[i]);
|
|
165
|
+
i += 1;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return out;
|
|
169
|
+
}
|
|
170
|
+
const PHRASES = new Set([...STYLE_NEAR.keys(), ...SUBJECT_NEAR.keys(), ...[...STYLE_NEAR.values(), ...SUBJECT_NEAR.values()].flat()].filter((term) => term.includes(" ")));
|
|
171
|
+
function joinPhrases(tokens) {
|
|
172
|
+
const out = [];
|
|
173
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
174
|
+
const next = tokens[i + 1];
|
|
175
|
+
if (next && PHRASES.has(`${tokens[i].stem} ${next.stem}`)) {
|
|
176
|
+
out.push({
|
|
177
|
+
raw: `${tokens[i].raw} ${next.raw}`,
|
|
178
|
+
stem: `${tokens[i].stem} ${next.stem}`
|
|
179
|
+
});
|
|
180
|
+
i += 1;
|
|
181
|
+
} else {
|
|
182
|
+
out.push(tokens[i]);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return out;
|
|
186
|
+
}
|
|
187
|
+
function parseTemplateQuery(text, options = {}) {
|
|
188
|
+
var _a, _b, _c, _d, _e;
|
|
189
|
+
const typed = (text != null ? text : "").replace(/\s+/g, " ").trim();
|
|
190
|
+
const ignored = [];
|
|
191
|
+
let tokens = fold(typed).split(NON_WORD).filter((w) => w.length > 1).map((raw) => ({
|
|
192
|
+
raw,
|
|
193
|
+
stem: stemWord(raw)
|
|
194
|
+
}));
|
|
195
|
+
const phrases = [...(_a = options.categoryWords) != null ? _a : [], "template"].map((p) => searchWords(p)).filter((p) => p.length > 0).sort((a, b) => b.length - a.length);
|
|
196
|
+
for (const phrase of phrases) tokens = removePhrase(tokens, phrase, ignored);
|
|
197
|
+
tokens = joinPhrases(tokens);
|
|
198
|
+
const typing = WORD_END.test(text != null ? text : "");
|
|
199
|
+
const last = tokens[tokens.length - 1];
|
|
200
|
+
const subjects = [];
|
|
201
|
+
const styles = [];
|
|
202
|
+
const seen = /* @__PURE__ */ new Set();
|
|
203
|
+
for (const token of tokens) {
|
|
204
|
+
const stem = token.stem.includes(" ") ? token.stem : fixTypo(token.stem);
|
|
205
|
+
const fixed = stem !== token.stem;
|
|
206
|
+
if (FILLER.has(stem) || FILLER.has((_b = LISTED.get(stem)) != null ? _b : "")) {
|
|
207
|
+
ignored.push(token.raw);
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
if (seen.has(stem)) continue;
|
|
211
|
+
if (subjects.length + styles.length >= MAX_CONCEPTS) {
|
|
212
|
+
ignored.push(token.raw);
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
seen.add(stem);
|
|
216
|
+
const word = fixed ? (_c = LISTED.get(stem)) != null ? _c : stem : token.raw;
|
|
217
|
+
if (STYLE_NEAR.has(stem)) {
|
|
218
|
+
styles.push({
|
|
219
|
+
word,
|
|
220
|
+
kind: "style",
|
|
221
|
+
terms: [stem, ...(_d = STYLE_NEAR.get(stem)) != null ? _d : []]
|
|
222
|
+
});
|
|
223
|
+
} else {
|
|
224
|
+
const unknown = !fixed && !KNOWN.has(stem) && !stem.includes(" ") && !/\d/.test(stem);
|
|
225
|
+
const prefix = unknown && typing && token === last && stem.length >= 3;
|
|
226
|
+
const typo = unknown && stem.length >= 5;
|
|
227
|
+
subjects.push(__spreadValues(__spreadValues({
|
|
228
|
+
word,
|
|
229
|
+
kind: "subject",
|
|
230
|
+
terms: [stem, ...(_e = SUBJECT_NEAR.get(stem)) != null ? _e : []]
|
|
231
|
+
}, prefix ? {
|
|
232
|
+
prefix
|
|
233
|
+
} : {}), typo ? {
|
|
234
|
+
typo
|
|
235
|
+
} : {}));
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
text: typed,
|
|
240
|
+
subjects,
|
|
241
|
+
styles,
|
|
242
|
+
ignored,
|
|
243
|
+
empty: subjects.length + styles.length === 0
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function backendWord(concept) {
|
|
247
|
+
const stem = concept.terms[0];
|
|
248
|
+
return concept.word.startsWith(stem) ? stem : concept.word;
|
|
249
|
+
}
|
|
250
|
+
function templateSearchReads(query, budget = 10) {
|
|
251
|
+
const reads = [];
|
|
252
|
+
const keys = /* @__PURE__ */ new Set();
|
|
253
|
+
const add = (parts, wide, stage, concept) => {
|
|
254
|
+
const words = [...new Set(parts.flatMap((p) => p.word.split(" ")))];
|
|
255
|
+
const key = [...words].sort().join(" ");
|
|
256
|
+
if (reads.length >= budget || words.length === 0 || keys.has(key)) return;
|
|
257
|
+
keys.add(key);
|
|
258
|
+
reads.push(__spreadValues({
|
|
259
|
+
words,
|
|
260
|
+
terms: [...new Set(parts.map((p) => p.term))],
|
|
261
|
+
wide,
|
|
262
|
+
stage
|
|
263
|
+
}, concept ? {
|
|
264
|
+
concept
|
|
265
|
+
} : {}));
|
|
266
|
+
};
|
|
267
|
+
const own = (c) => ({
|
|
268
|
+
word: backendWord(c),
|
|
269
|
+
term: c.terms[0]
|
|
270
|
+
});
|
|
271
|
+
const subjects = query.subjects.map(own);
|
|
272
|
+
const styles = query.styles.map(own);
|
|
273
|
+
if (subjects.length + styles.length > 1) add([...subjects, ...styles], true, 1);
|
|
274
|
+
if (subjects.length > 1 && styles.length > 0) add(subjects, true, 1);
|
|
275
|
+
for (const s of subjects) add([s], true, 1, s.term);
|
|
276
|
+
if (subjects.length > 0) for (const y of styles) add([subjects[0], y], false, 1);
|
|
277
|
+
if (subjects.length === 0) for (const y of styles) add([y], true, 1, y.term);
|
|
278
|
+
const concepts = subjects.length > 0 ? query.subjects : query.styles;
|
|
279
|
+
for (let k = 1; reads.length < budget; k++) {
|
|
280
|
+
let any = false;
|
|
281
|
+
for (const c of concepts) {
|
|
282
|
+
const term = c.terms[k];
|
|
283
|
+
if (term === void 0) continue;
|
|
284
|
+
any = true;
|
|
285
|
+
add([{
|
|
286
|
+
word: term,
|
|
287
|
+
term
|
|
288
|
+
}], false, 2, c.terms[0]);
|
|
289
|
+
}
|
|
290
|
+
if (!any) break;
|
|
291
|
+
}
|
|
292
|
+
return reads;
|
|
293
|
+
}
|
|
294
|
+
const STRUCTURAL_TAG = /^(canvas-[a-z-]+|video-studio|\d+:\d+|presentation|carousel|flyer|business-cards?|logo|banner|brochure|branding|social-post|certificate|worksheet|proposal|newsletter|menu|infographic)$/;
|
|
295
|
+
function templateSearchText(fields, titleComplete = true) {
|
|
296
|
+
var _a, _b, _c, _d, _e, _f;
|
|
297
|
+
const tags = ((_a = fields.tags) != null ? _a : []).filter((t) => !STRUCTURAL_TAG.test(t.toLowerCase()));
|
|
298
|
+
const tagText = [...tags, (_b = fields.category) != null ? _b : ""].join(" ");
|
|
299
|
+
const joinedTags = tags.map((t) => fold(t).replace(NON_WORD_ALL, "")).filter((t) => t.length > 1);
|
|
300
|
+
return {
|
|
301
|
+
title: searchWords((_c = fields.title) != null ? _c : ""),
|
|
302
|
+
tags: [...searchWords(tagText), ...joinedTags],
|
|
303
|
+
summary: searchWords(`${(_d = fields.summary) != null ? _d : ""} ${(_e = fields.description) != null ? _e : ""}`),
|
|
304
|
+
visible: fold(`${(_f = fields.title) != null ? _f : ""} ${tagText}`),
|
|
305
|
+
titleComplete
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
function nearWord(a, b) {
|
|
309
|
+
const min = Math.min(a.length, b.length);
|
|
310
|
+
if (min < 5 || Math.abs(a.length - b.length) > 3) return false;
|
|
311
|
+
let common = 0;
|
|
312
|
+
while (common < min && a[common] === b[common]) common++;
|
|
313
|
+
return common >= Math.max(5, min - 2);
|
|
314
|
+
}
|
|
315
|
+
function typoOf(term, word) {
|
|
316
|
+
if (word.length < 5 || word[0] !== term[0]) return false;
|
|
317
|
+
const max = term.length >= 8 ? 2 : 1;
|
|
318
|
+
return editDistance(term, word, max) <= max;
|
|
319
|
+
}
|
|
320
|
+
function findTerm(term, words, {
|
|
321
|
+
loose = false,
|
|
322
|
+
prefix = false,
|
|
323
|
+
typo = false
|
|
324
|
+
} = {}) {
|
|
325
|
+
const parts = term.split(" ");
|
|
326
|
+
if (parts.length > 1) {
|
|
327
|
+
const joined = parts.join("");
|
|
328
|
+
for (let i = 0; i < words.length; i++) {
|
|
329
|
+
if (words[i] === joined) return {
|
|
330
|
+
quality: 1,
|
|
331
|
+
at: i
|
|
332
|
+
};
|
|
333
|
+
if (parts.every((p, k) => words[i + k] === p)) return {
|
|
334
|
+
quality: 1,
|
|
335
|
+
at: i
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
340
|
+
let near = null;
|
|
341
|
+
for (let i = 0; i < words.length; i++) {
|
|
342
|
+
if (words[i] === term) return {
|
|
343
|
+
quality: 1,
|
|
344
|
+
at: i
|
|
345
|
+
};
|
|
346
|
+
if ((near == null ? void 0 : near.quality) === 0.9) continue;
|
|
347
|
+
if (loose && nearWord(term, words[i])) near = {
|
|
348
|
+
quality: 0.9,
|
|
349
|
+
at: i
|
|
350
|
+
};
|
|
351
|
+
else if (typo && (!near || near.quality < 0.85) && typoOf(term, words[i])) near = {
|
|
352
|
+
quality: 0.85,
|
|
353
|
+
at: i
|
|
354
|
+
};
|
|
355
|
+
else if (prefix && !near && words[i].startsWith(term)) near = {
|
|
356
|
+
quality: 0.8,
|
|
357
|
+
at: i
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
return near;
|
|
361
|
+
}
|
|
362
|
+
const FIELD_WEIGHT = {
|
|
363
|
+
// A subject word in the title or tags is the template's real subject; in the visual summary
|
|
364
|
+
// it is often an accident ("an opening paragraph").
|
|
365
|
+
subject: {
|
|
366
|
+
title: 1,
|
|
367
|
+
tags: 0.8,
|
|
368
|
+
summary: 0.35
|
|
369
|
+
},
|
|
370
|
+
// A style word in the summary is what the cover looks like: good evidence.
|
|
371
|
+
style: {
|
|
372
|
+
title: 1,
|
|
373
|
+
tags: 0.7,
|
|
374
|
+
summary: 0.75
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
const ELSEWHERE_WEIGHT = {
|
|
378
|
+
subject: {
|
|
379
|
+
complete: 0.3,
|
|
380
|
+
cut: 0.45
|
|
381
|
+
},
|
|
382
|
+
style: 0.6
|
|
383
|
+
};
|
|
384
|
+
const NEAR_TERM_WEIGHT = 0.85;
|
|
385
|
+
function evidenceFor(concept, text, foundBy) {
|
|
386
|
+
let best = {
|
|
387
|
+
strength: 0,
|
|
388
|
+
field: null,
|
|
389
|
+
at: -1
|
|
390
|
+
};
|
|
391
|
+
const loose = concept.kind === "subject";
|
|
392
|
+
concept.terms.forEach((term, index) => {
|
|
393
|
+
const termWeight = index === 0 ? 1 : NEAR_TERM_WEIGHT;
|
|
394
|
+
for (const field of ["title", "tags", "summary"]) {
|
|
395
|
+
const hit = findTerm(term, text[field], {
|
|
396
|
+
loose,
|
|
397
|
+
prefix: index === 0 && concept.prefix === true,
|
|
398
|
+
typo: index === 0 && concept.typo === true
|
|
399
|
+
});
|
|
400
|
+
if (!hit) continue;
|
|
401
|
+
const strength = FIELD_WEIGHT[concept.kind][field] * termWeight * hit.quality;
|
|
402
|
+
if (strength > best.strength) best = {
|
|
403
|
+
strength,
|
|
404
|
+
field,
|
|
405
|
+
at: field === "title" ? hit.at : -1
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
if ((foundBy == null ? void 0 : foundBy.has(term)) && !term.split(" ").some((p) => text.visible.includes(p))) {
|
|
409
|
+
const strength = (concept.kind === "subject" ? text.titleComplete ? ELSEWHERE_WEIGHT.subject.complete : ELSEWHERE_WEIGHT.subject.cut : ELSEWHERE_WEIGHT.style) * termWeight;
|
|
410
|
+
if (strength > best.strength) best = {
|
|
411
|
+
strength,
|
|
412
|
+
field: "elsewhere",
|
|
413
|
+
at: -1
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
return best;
|
|
418
|
+
}
|
|
419
|
+
const mean = (xs) => xs.length ? xs.reduce((a, b) => a + b, 0) / xs.length : 0;
|
|
420
|
+
function scoreTemplate(query, text, foundBy) {
|
|
421
|
+
if (query.empty) return {
|
|
422
|
+
score: 0,
|
|
423
|
+
match: null
|
|
424
|
+
};
|
|
425
|
+
const subjects = query.subjects.map((c) => evidenceFor(c, text, foundBy));
|
|
426
|
+
const styles = query.styles.map((c) => evidenceFor(c, text, foundBy));
|
|
427
|
+
let match = null;
|
|
428
|
+
if (subjects.length > 0) {
|
|
429
|
+
if (subjects.every((e) => e.field === "title" || e.field === "tags")) match = "exact";
|
|
430
|
+
else if (subjects.some((e) => e.strength > 0)) match = "close";
|
|
431
|
+
} else {
|
|
432
|
+
const present = styles.filter((e) => e.strength >= 0.5).length;
|
|
433
|
+
if (present >= Math.ceil(styles.length / 2)) match = "exact";
|
|
434
|
+
else if (styles.some((e) => e.strength > 0)) match = "close";
|
|
435
|
+
}
|
|
436
|
+
if (!match) return {
|
|
437
|
+
score: 0,
|
|
438
|
+
match: null
|
|
439
|
+
};
|
|
440
|
+
let phrase = 0;
|
|
441
|
+
for (let i = 0; i + 1 < subjects.length; i++) {
|
|
442
|
+
const [a, b] = [subjects[i].at, subjects[i + 1].at];
|
|
443
|
+
if (a < 0 || b < 0) continue;
|
|
444
|
+
const gap = b - a;
|
|
445
|
+
phrase += gap === 1 ? 1 : gap > 1 && gap <= 3 || gap === -1 ? 0.5 : 0;
|
|
446
|
+
}
|
|
447
|
+
if (subjects.length > 1) phrase /= subjects.length - 1;
|
|
448
|
+
const primary = subjects.length > 0 ? mean(subjects.map((e) => e.strength)) : mean(styles.map((e) => e.strength));
|
|
449
|
+
const secondary = subjects.length > 0 ? mean(styles.map((e) => e.strength)) : 0;
|
|
450
|
+
const words = text.title.filter((w) => !FILLER.has(w));
|
|
451
|
+
const inTitle = [...subjects, ...styles].filter((e) => e.field === "title").length;
|
|
452
|
+
const focus = words.length > 0 ? Math.min(1, inTitle / words.length) : 0;
|
|
453
|
+
const tier = match === "exact" ? 2e3 : 1e3;
|
|
454
|
+
return {
|
|
455
|
+
score: tier + 100 * primary + 40 * secondary + 15 * phrase + 8 * focus,
|
|
456
|
+
match
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
function rankTemplates(query, items, textOf, foundByOf) {
|
|
460
|
+
const ranked = [];
|
|
461
|
+
items.forEach((item, order) => {
|
|
462
|
+
const {
|
|
463
|
+
score,
|
|
464
|
+
match
|
|
465
|
+
} = scoreTemplate(query, textOf(item), foundByOf == null ? void 0 : foundByOf(item));
|
|
466
|
+
if (match) ranked.push({
|
|
467
|
+
item,
|
|
468
|
+
score,
|
|
469
|
+
match,
|
|
470
|
+
order
|
|
471
|
+
});
|
|
472
|
+
});
|
|
473
|
+
ranked.sort((a, b) => b.score - a.score || a.order - b.order);
|
|
474
|
+
return ranked.map(({
|
|
475
|
+
item,
|
|
476
|
+
score,
|
|
477
|
+
match
|
|
478
|
+
}) => ({
|
|
479
|
+
item,
|
|
480
|
+
score,
|
|
481
|
+
match
|
|
482
|
+
}));
|
|
483
|
+
}
|
|
484
|
+
function titleFromRowName(name, group) {
|
|
485
|
+
const rest = name.startsWith(`${group}-`) ? name.slice(group.length + 1) : name;
|
|
486
|
+
const parts = rest.split("-");
|
|
487
|
+
if (parts.length > 1) parts.pop();
|
|
488
|
+
return parts.join(" ");
|
|
489
|
+
}export{NON_WORD,TEMPLATE_CATEGORY_WORDS,parseTemplateQuery,rankTemplates,scoreTemplate,searchWords,stemWord,templateSearchReads,templateSearchText,titleFromRowName};//# sourceMappingURL=templateSearch.js.map
|